Migrate away from legacy setters
[bgpcep.git] / rsvp / spi / src / test / java / org / opendaylight / protocol / rsvp / parser / spi / subobjects / EROSubobjectListParserTest.java
index 6d6cf4ab5a2470e60e2b31bd3efbebe6190b7521..28f7d3df3ba8a77a4a688c6f4f5a4f4827122e13 100644 (file)
@@ -11,6 +11,7 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Arrays;
@@ -23,6 +24,7 @@ import org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.AttributeFilter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainer;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public class EROSubobjectListParserTest {
 
@@ -30,9 +32,9 @@ public class EROSubobjectListParserTest {
     private final SubobjectContainer subObj = Mockito.mock(SubobjectContainer.class);
     private final RsvpTeObject rsvpTeObj = Mockito.mock(RsvpTeObject.class);
     private final EroListParser parser = new EroListParser(this.registry);
-    private final byte[] inputList = new byte[] {1, 3, 1, 2, 4, 1, 2};
-    private final byte[] emptyInput = new byte[] {1, 2};
-    private final byte[] wrongInput = new byte[] {1, 3};
+    private final byte[] inputList = new byte[]{1, 3, 1, 2, 4, 1, 2};
+    private final byte[] emptyInput = new byte[]{1, 2};
+    private final byte[] wrongInput = new byte[]{1, 3};
     private final List<SubobjectContainer> subobjects = Arrays.asList(this.subObj, this.subObj);
 
     @Before
@@ -50,12 +52,12 @@ public class EROSubobjectListParserTest {
         }).when(this.registry).serializeSubobject(Mockito.any(SubobjectContainer.class), Mockito.any(ByteBuf.class));
     }
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testParsingException() throws RSVPParsingException {
         this.parser.parseList(null);
     }
 
-    @Test(expected=RSVPParsingException.class)
+    @Test(expected = RSVPParsingException.class)
     public void testWrongInput() throws RSVPParsingException {
         this.parser.parseList(Unpooled.copiedBuffer(this.wrongInput));
     }
@@ -78,14 +80,14 @@ public class EROSubobjectListParserTest {
     @Test
     public void testAbstractRSVPObjParser() throws RSVPParsingException {
         final ByteBuf byteAggregator = Unpooled.buffer(4);
-        byte[] output = new byte[] {0, 1, 2, 3};
-        this.parser.serializeAttributeHeader(1, (short) 2, (short) 3, byteAggregator);
+        byte[] output = new byte[]{0, 1, 2, 3};
+        EroListParser.serializeAttributeHeader(1, (short) 2, (short) 3, byteAggregator);
         assertArrayEquals(output, byteAggregator.array());
 
         final ByteBuf body = Unpooled.buffer(4);
-        output = new byte[] {0, 0, 0, 1};
-        final AttributeFilter filter = new AttributeFilter(1L);
-        this.parser.writeAttributeFilter(filter, body);
+        output = new byte[]{0, 0, 0, 1};
+        final AttributeFilter filter = new AttributeFilter(Uint32.ONE);
+        EroListParser.writeAttributeFilter(filter, body);
         assertArrayEquals(output, body.array());
 
         final ByteBuf parseTeObj = Unpooled.buffer(1);
@@ -101,13 +103,15 @@ public class EROSubobjectListParserTest {
     }
 
     private class EroListParser extends EROSubobjectListParser {
-        public EroListParser(final EROSubobjectRegistry subobjReg) {
+        EroListParser(final EROSubobjectRegistry subobjReg) {
             super(subobjReg);
         }
+
         @Override
         protected void localSerializeObject(final RsvpTeObject rsvpTeObject, final ByteBuf output) {
             output.writeByte(3);
         }
+
         @Override
         protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
             return EROSubobjectListParserTest.this.rsvpTeObj;