aboutsummaryrefslogtreecommitdiff
path: root/guava-tests/test/com/google/common/graph/EndpointPairTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava-tests/test/com/google/common/graph/EndpointPairTest.java')
-rw-r--r--guava-tests/test/com/google/common/graph/EndpointPairTest.java15
1 files changed, 4 insertions, 11 deletions
diff --git a/guava-tests/test/com/google/common/graph/EndpointPairTest.java b/guava-tests/test/com/google/common/graph/EndpointPairTest.java
index c67693a71..391f4c838 100644
--- a/guava-tests/test/com/google/common/graph/EndpointPairTest.java
+++ b/guava-tests/test/com/google/common/graph/EndpointPairTest.java
@@ -17,7 +17,7 @@
package com.google.common.graph;
import static com.google.common.truth.Truth.assertThat;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertThrows;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@@ -91,11 +91,7 @@ public final class EndpointPairTest {
for (MutableNetwork<Integer, String> network : testNetworks) {
network.addEdge(1, 2, "1-2");
EndpointPair<Integer> endpointPair = network.incidentNodes("1-2");
- try {
- endpointPair.adjacentNode(3);
- fail("Should have rejected adjacentNode() called with a node not incident to edge.");
- } catch (IllegalArgumentException expected) {
- }
+ assertThrows(IllegalArgumentException.class, () -> endpointPair.adjacentNode(3));
}
}
@@ -195,11 +191,8 @@ public final class EndpointPairTest {
directedGraph.removeEdge(N2, N1);
containsExactlySanityCheck(edges);
- try {
- edges.add(EndpointPair.ordered(N1, N2));
- fail("Set returned by edges() should be unmodifiable");
- } catch (UnsupportedOperationException expected) {
- }
+ assertThrows(
+ UnsupportedOperationException.class, () -> edges.add(EndpointPair.ordered(N1, N2)));
}
@Test