Skip to content
Permalink
Browse files
Fix tests (again, failing on GH, ok, locally).
  • Loading branch information
Gary Gregory committed Aug 13, 2021
1 parent b5bb89d commit 490f937c6f09dcea4a952d9049116056ed319698
Showing 1 changed file with 13 additions and 10 deletions.
@@ -17,11 +17,12 @@
package org.apache.commons.pool2.impl;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;

import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
@@ -49,12 +50,14 @@ public void testInitialStateActiveDuration() throws InterruptedException {
assertFalse(dpo.getActiveDuration().isNegative());
assertFalse(dpo.getActiveDuration().isZero());
// We use greaterThanOrEqualTo instead of equal because "now" many be different when each argument is evaluated.
assertThat(dpo.getActiveDuration(), greaterThanOrEqualTo(dpo.getIdleDuration()));
assertThat(1L, lessThanOrEqualTo(2L)); // sanity check
assertThat(Duration.ZERO, lessThanOrEqualTo(Duration.ZERO.plusNanos(1))); // sanity check
assertThat(dpo.getActiveDuration(), lessThanOrEqualTo(dpo.getIdleDuration()));
// Depreacted
assertThat(dpo.getActiveDuration().toMillis(), greaterThanOrEqualTo(dpo.getActiveTimeMillis()));
assertThat(dpo.getActiveDuration(), greaterThanOrEqualTo(dpo.getActiveTime()));
assertThat(dpo.getActiveDuration(), greaterThanOrEqualTo(dpo.getIdleTime()));
assertThat(dpo.getActiveDuration().toMillis(), greaterThanOrEqualTo(dpo.getIdleTimeMillis()));
assertThat(dpo.getActiveDuration().toMillis(), lessThanOrEqualTo(dpo.getActiveTimeMillis()));
assertThat(dpo.getActiveDuration(), lessThanOrEqualTo(dpo.getActiveTime()));
assertThat(dpo.getActiveDuration(), lessThanOrEqualTo(dpo.getIdleTime()));
assertThat(dpo.getActiveDuration().toMillis(), lessThanOrEqualTo(dpo.getIdleTimeMillis()));
}

@Test
@@ -70,10 +73,10 @@ public void testInitialStateIdleDuration() throws InterruptedException {
// We use greaterThanOrEqualTo instead of equal because "now" many be different when each argument is evaluated.
assertThat(dpo.getIdleDuration(), greaterThanOrEqualTo(dpo.getActiveDuration()));
// Depreacted
assertThat(dpo.getIdleDuration().toMillis(), greaterThanOrEqualTo(dpo.getIdleTimeMillis()));
assertThat(dpo.getIdleDuration(), greaterThanOrEqualTo(dpo.getIdleTime()));
assertThat(dpo.getIdleDuration(), greaterThanOrEqualTo(dpo.getActiveTime()));
assertThat(dpo.getIdleDuration().toMillis(), greaterThanOrEqualTo(dpo.getActiveTimeMillis()));
assertThat(dpo.getIdleDuration().toMillis(), lessThanOrEqualTo(dpo.getIdleTimeMillis()));
assertThat(dpo.getIdleDuration(), lessThanOrEqualTo(dpo.getIdleTime()));
assertThat(dpo.getIdleDuration(), lessThanOrEqualTo(dpo.getActiveTime()));
assertThat(dpo.getIdleDuration().toMillis(), lessThanOrEqualTo(dpo.getActiveTimeMillis()));
}

@Test

0 comments on commit 490f937

Please sign in to comment.