1717package org .apache .commons .pool2 .impl ;
1818
1919import static org .junit .jupiter .api .Assertions .assertEquals ;
20+ import static org .junit .jupiter .api .Assertions .assertFalse ;
2021
2122import java .time .Duration ;
2223
@@ -30,41 +31,44 @@ public class TestEvictionConfig {
3031 @ Test
3132 public void testConstructor1s () {
3233 final EvictionConfig config = new EvictionConfig (Duration .ofMillis (1 ), Duration .ofMillis (1 ), 1 );
33-
3434 assertEquals (1 , config .getIdleEvictDuration ().toMillis ());
3535 assertEquals (1 , config .getIdleEvictTime ());
3636 assertEquals (1 , config .getIdleEvictTimeDuration ().toMillis ());
3737 assertEquals (1 , config .getIdleSoftEvictDuration ().toMillis ());
3838 assertEquals (1 , config .getIdleSoftEvictTime ());
3939 assertEquals (1 , config .getIdleSoftEvictTimeDuration ().toMillis ());
4040 assertEquals (1 , config .getMinIdle ());
41+ // toString() should never throw
42+ assertFalse (config .toString ().isEmpty ());
4143 }
4244
4345 @ Test
4446 public void testConstructorZerosDurations () {
4547 final EvictionConfig config = new EvictionConfig (Duration .ZERO , Duration .ZERO , 0 );
46-
4748 assertEquals (Long .MAX_VALUE , config .getIdleEvictDuration ().toMillis ());
4849 assertEquals (Long .MAX_VALUE , config .getIdleEvictTime ());
4950 assertEquals (Long .MAX_VALUE , config .getIdleEvictTimeDuration ().toMillis ());
5051 assertEquals (Long .MAX_VALUE , config .getIdleSoftEvictDuration ().toMillis ());
5152 assertEquals (Long .MAX_VALUE , config .getIdleSoftEvictTime ());
5253 assertEquals (Long .MAX_VALUE , config .getIdleSoftEvictTimeDuration ().toMillis ());
5354 assertEquals (0 , config .getMinIdle ());
55+ // toString() should never throw
56+ assertFalse (config .toString ().isEmpty ());
5457 }
5558
5659 @ Test
5760 public void testConstructorZerosMillis () {
5861 @ SuppressWarnings ("deprecation" )
5962 final EvictionConfig config = new EvictionConfig (0 , 0 , 0 );
60-
6163 assertEquals (Long .MAX_VALUE , config .getIdleEvictDuration ().toMillis ());
6264 assertEquals (Long .MAX_VALUE , config .getIdleEvictTime ());
6365 assertEquals (Long .MAX_VALUE , config .getIdleEvictTimeDuration ().toMillis ());
6466 assertEquals (Long .MAX_VALUE , config .getIdleSoftEvictDuration ().toMillis ());
6567 assertEquals (Long .MAX_VALUE , config .getIdleSoftEvictTime ());
6668 assertEquals (Long .MAX_VALUE , config .getIdleSoftEvictTimeDuration ().toMillis ());
6769 assertEquals (0 , config .getMinIdle ());
70+ // toString() should never throw
71+ assertFalse (config .toString ().isEmpty ());
6872 }
6973
7074}
0 commit comments