Skip to content
Permalink
Browse files
Refactor test constants.
  • Loading branch information
Gary Gregory committed Aug 12, 2021
1 parent 291d980 commit 3abe560d284f64ee0444b782bab3e4794d9a445c
Showing 1 changed file with 11 additions and 12 deletions.
@@ -26,6 +26,9 @@

public class TestPoolImplUtils {

private static final Instant INSTANT_1 = Instant.ofEpochMilli(1);
private static final Instant INSTANT_0 = Instant.ofEpochMilli(0);

@SuppressWarnings("unused")
private abstract static class FactoryAB<A, B> extends BasePooledObjectFactory<B> {
// empty by design
@@ -86,21 +89,17 @@ public void testFactoryTypeSimple() {

@Test
public void testMaxInstants() {
final Instant instant0 = Instant.ofEpochMilli(0);
final Instant instant1 = Instant.ofEpochMilli(1);
assertEquals(instant1, PoolImplUtils.max(instant0, instant1));
assertEquals(instant1, PoolImplUtils.max(instant1, instant0));
assertEquals(instant1, PoolImplUtils.max(instant1, instant1));
assertEquals(instant0, PoolImplUtils.max(instant0, instant0));
assertEquals(INSTANT_1, PoolImplUtils.max(INSTANT_0, INSTANT_1));
assertEquals(INSTANT_1, PoolImplUtils.max(INSTANT_1, INSTANT_0));
assertEquals(INSTANT_1, PoolImplUtils.max(INSTANT_1, INSTANT_1));
assertEquals(INSTANT_0, PoolImplUtils.max(INSTANT_0, INSTANT_0));
}

@Test
public void testMinInstants() {
final Instant instant0 = Instant.ofEpochMilli(0);
final Instant instant1 = Instant.ofEpochMilli(1);
assertEquals(instant0, PoolImplUtils.min(instant0, instant1));
assertEquals(instant0, PoolImplUtils.min(instant1, instant0));
assertEquals(instant1, PoolImplUtils.min(instant1, instant1));
assertEquals(instant0, PoolImplUtils.min(instant0, instant0));
assertEquals(INSTANT_0, PoolImplUtils.min(INSTANT_0, INSTANT_1));
assertEquals(INSTANT_0, PoolImplUtils.min(INSTANT_1, INSTANT_0));
assertEquals(INSTANT_1, PoolImplUtils.min(INSTANT_1, INSTANT_1));
assertEquals(INSTANT_0, PoolImplUtils.min(INSTANT_0, INSTANT_0));
}
}

0 comments on commit 3abe560

Please sign in to comment.