Improve a few assertion fails in tests

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135479183
This commit is contained in:
mcilwain 2016-07-27 08:37:22 -04:00 committed by Ben McIlwain
parent b62e60ed7e
commit aaa84d6ec6
5 changed files with 12 additions and 31 deletions

View file

@ -15,7 +15,6 @@
package google.registry.monitoring.metrics;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -123,12 +122,9 @@ public class CounterTest {
"vdn",
ImmutableSet.of(LabelDescriptor.create("label1", "bar")));
try {
counter.incrementBy(-1L, "foo");
fail("Test should not allow non-negative offsets");
} catch (IllegalArgumentException expected) {
assertThat(expected).hasMessage("The offset provided must be non-negative");
}
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("The offset provided must be non-negative");
counter.incrementBy(-1L, "foo");
}
@Test