Cleanup deprecation warnings in bgp/parser-spi 92/90792/1
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 28 Jun 2020 15:11:45 +0000 (17:11 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 28 Jun 2020 15:11:45 +0000 (17:11 +0200)
Eliminate some leftovers from codegen change.

Change-Id: I2e7dfc74ef4639e52bfa8887836e9e6c2c9b290e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/MultiprotocolCapabilitiesUtil.java
bgp/parser-spi/src/test/java/org/opendaylight/protocol/bgp/parser/spi/pojo/UnrecognizedAttributesTest.java

index 88dc5f84320f9827131cd023ccfec8c08f11a12a..4ba56732ac62496d040dceaa0669fceabf8553ed 100644 (file)
@@ -14,7 +14,6 @@ import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.open.message.bgp.parameters.optional.capabilities.CParameters;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.open.message.bgp.parameters.optional.capabilities.CParametersBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.BgpTableType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.CParameters1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.CParameters1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.RouteRefreshCapabilityBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.AddressFamily;
@@ -23,8 +22,10 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public final class MultiprotocolCapabilitiesUtil {
-    public static final CParameters RR_CAPABILITY = new CParametersBuilder().addAugmentation(CParameters1.class,
-        new CParameters1Builder().setRouteRefreshCapability(new RouteRefreshCapabilityBuilder().build()).build())
+    public static final CParameters RR_CAPABILITY = new CParametersBuilder()
+            .addAugmentation(new CParameters1Builder()
+                .setRouteRefreshCapability(new RouteRefreshCapabilityBuilder().build())
+                .build())
             .build();
 
     private static final Logger LOG = LoggerFactory.getLogger(MultiprotocolCapabilitiesUtil.class);
index 6ab7ae1ce2afb85a326d7789c926b15688e26f35..f319059380260390bff1bd2e3ea1c22156d07ce5 100644 (file)
@@ -9,13 +9,12 @@ package org.opendaylight.protocol.bgp.parser.spi.pojo;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThrows;
 import static org.junit.Assert.assertTrue;
 
 import io.netty.buffer.Unpooled;
 import java.util.Map;
-import org.junit.Rule;
 import org.junit.Test;
-import org.junit.rules.ExpectedException;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.util.ByteArray;
@@ -31,15 +30,14 @@ public class UnrecognizedAttributesTest {
 
     private static final SimpleAttributeRegistry SIMPLE_ATTR_REG = new SimpleAttributeRegistry();
 
-    @Rule
-    public ExpectedException expException = ExpectedException.none();
-
     @Test
     public void testUnrecognizedAttributesWithoutOptionalFlag() throws BGPDocumentedException, BGPParsingException {
-        this.expException.expect(BGPDocumentedException.class);
-        this.expException.expectMessage("Well known attribute not recognized.");
-        SIMPLE_ATTR_REG.parseAttributes(
-            Unpooled.wrappedBuffer(new byte[] { 0x03, 0x00, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05 }), null);
+        final BGPDocumentedException ex = assertThrows(BGPDocumentedException.class, () -> {
+            SIMPLE_ATTR_REG.parseAttributes(
+                Unpooled.wrappedBuffer(new byte[] { 0x03, 0x00, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05 }), null);
+        });
+
+        assertEquals("Well known attribute not recognized.", ex.getMessage());
     }
 
     @Test