mirror of
https://github.com/google/nomulus.git
synced 2025-07-19 17:26:09 +02:00
Use backported JUnit exceptThrows and assertThrows in metrics library
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=176584707
This commit is contained in:
parent
6eb0d8689d
commit
a92cdbe8c3
17 changed files with 325 additions and 226 deletions
|
@ -15,7 +15,7 @@
|
|||
package google.registry.monitoring.metrics;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
import static google.registry.monitoring.metrics.JUnitBackports.expectThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.junit.Test;
|
||||
|
@ -28,22 +28,16 @@ public class FibonacciFitterTest {
|
|||
|
||||
@Test
|
||||
public void testCreate_maxBucketSizeNegative_throwsException() {
|
||||
try {
|
||||
FibonacciFitter.create(-1);
|
||||
fail("Expected exception");
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertThat(e).hasMessageThat().isEqualTo("maxBucketSize must be greater than 0");
|
||||
}
|
||||
IllegalArgumentException e =
|
||||
expectThrows(IllegalArgumentException.class, () -> FibonacciFitter.create(-1));
|
||||
assertThat(e).hasMessageThat().isEqualTo("maxBucketSize must be greater than 0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreate_maxBucketSizeZero_throwsException() {
|
||||
try {
|
||||
FibonacciFitter.create(0);
|
||||
fail("Expected exception");
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertThat(e).hasMessageThat().isEqualTo("maxBucketSize must be greater than 0");
|
||||
}
|
||||
IllegalArgumentException e =
|
||||
expectThrows(IllegalArgumentException.class, () -> FibonacciFitter.create(0));
|
||||
assertThat(e).hasMessageThat().isEqualTo("maxBucketSize must be greater than 0");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue