@@ -38,17 +38,20 @@ public void testOffline() throws InterruptedException, SQLException {
3838
3939 ConnectionPool pool = new ConnectionPool ("testOffline" , config );
4040 assertThat (pool .isOnline ()).isFalse ();
41+ assertThat (pool .size ()).isEqualTo (0 );
4142 log .info ("pool created " );
4243 Thread .sleep (3000 );
4344
4445 assertEquals (0 , pool .getStatus (false ).getFree ());
4546 assertEquals (0 , pool .getStatus (false ).getBusy ());
47+ assertThat (pool .size ()).isEqualTo (0 );
4648
4749 pool .online ();
4850 log .info ("pool online" );
4951 assertThat (pool .isOnline ()).isTrue ();
5052 assertEquals (2 , pool .getStatus (false ).getFree ());
5153 assertEquals (0 , pool .getStatus (false ).getBusy ());
54+ assertThat (pool .size ()).isEqualTo (2 );
5255
5356 Thread .sleep (3000 );
5457
@@ -57,6 +60,7 @@ public void testOffline() throws InterruptedException, SQLException {
5760 assertThat (pool .isOnline ()).isFalse ();
5861 assertEquals (0 , pool .getStatus (false ).getFree ());
5962 assertEquals (0 , pool .getStatus (false ).getBusy ());
63+ assertThat (pool .size ()).isEqualTo (0 );
6064
6165 Thread .sleep (3000 );
6266
@@ -65,13 +69,15 @@ public void testOffline() throws InterruptedException, SQLException {
6569 assertThat (pool .isOnline ()).isTrue ();
6670 assertEquals (2 , pool .getStatus (false ).getFree ());
6771 assertEquals (0 , pool .getStatus (false ).getBusy ());
72+ assertThat (pool .size ()).isEqualTo (2 );
6873 Thread .sleep (3000 );
6974
7075 pool .shutdown ();
7176
7277 assertThat (pool .isOnline ()).isFalse ();
7378 assertEquals (0 , pool .getStatus (false ).getFree ());
7479 assertEquals (0 , pool .getStatus (false ).getBusy ());
80+ assertThat (pool .size ()).isEqualTo (0 );
7581 }
7682
7783 @ Test
@@ -119,17 +125,20 @@ public void offline_whenBusy_allowed() throws SQLException, InterruptedException
119125 Thread .sleep (200 );
120126 System .out .println ("-- taking pool offline (with a busy connection)" );
121127 assertEquals (1 , pool .getStatus (false ).getBusy ());
128+ assertThat (pool .size ()).isEqualTo (2 );
122129
123130 pool .offline ();
124131 assertEquals (0 , pool .getStatus (false ).getFree ());
125132 assertEquals (1 , pool .getStatus (false ).getBusy ()); // still 1 busy connection
133+ assertThat (pool .size ()).isEqualTo (1 );
126134
127135 // a bit of time to let busy connection finish and close
128136 Thread .sleep (4000 );
129137
130138 // all done now
131139 assertEquals (0 , pool .getStatus (false ).getFree ());
132140 assertEquals (0 , pool .getStatus (false ).getBusy ());
141+ assertThat (pool .size ()).isEqualTo (0 );
133142 }
134143
135144 @ Test
0 commit comments