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;
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);
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;
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