Migrate tests away from Optional.get()
[bgpcep.git] / bgp / openconfig-rp-statement / src / test / java / org / opendaylight / protocol / bgp / openconfig / routing / policy / statement / MatchCommunityTest.java
index eab342a49e648a8a7a1f58be1101cd75c2443129..95436d90cd378590b772fd92977e746f1289e11e 100644 (file)
@@ -42,7 +42,7 @@ public class MatchCommunityTest extends AbstractStatementRegistryConsumerTest {
     @Test
     public void testComAny() {
         Statement statement = basicStatements.stream()
-                .filter(st -> st.getName().equals("community-any-test")).findFirst().get();
+                .filter(st -> st.getName().equals("community-any-test")).findFirst().orElseThrow();
         RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(
                 new AttributesBuilder().build());
         RouteAttributeContainer result = statementRegistry.applyExportStatement(
@@ -63,7 +63,7 @@ public class MatchCommunityTest extends AbstractStatementRegistryConsumerTest {
     @Test
     public void testComInvert() {
         Statement statement = basicStatements.stream()
-                .filter(st -> st.getName().equals("community-invert-test")).findFirst().get();
+                .filter(st -> st.getName().equals("community-invert-test")).findFirst().orElseThrow();
         RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(
                 new AttributesBuilder().build());
         RouteAttributeContainer result = statementRegistry.applyExportStatement(
@@ -84,7 +84,7 @@ public class MatchCommunityTest extends AbstractStatementRegistryConsumerTest {
     @Test
     public void testComAll() {
         Statement statement = basicStatements.stream()
-                .filter(st -> st.getName().equals("community-all-test")).findFirst().get();
+                .filter(st -> st.getName().equals("community-all-test")).findFirst().orElseThrow();
         RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(
                 new AttributesBuilder().build());
         RouteAttributeContainer result = statementRegistry.applyExportStatement(