### Question:
OxmIpv6SrcSerializer extends AbstractOxmIpv6AddressSerializer { @Override public void serialize(MatchEntry entry, ByteBuf outBuffer) { super.serialize(entry, outBuffer); Ipv6SrcCase entryValue = (Ipv6SrcCase) entry.getMatchEntryValue(); writeIpv6Address(entryValue.getIpv6Src().getIpv6Address().getValue(), outBuffer); if (entry.isHasMask()) { writeMask(entryValue.getIpv6Src().getMask(), outBuffer, EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES); } }  @Override void serialize(MatchEntry entry, ByteBuf outBuffer);  }### Answer:
@Test public void testSerializeWithoutMask() { MatchEntryBuilder builder = prepareMatchEntry(false, "aaaa:bbbb:1111:2222::"); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, false); Assert.assertEquals("Wrong ipv6 address", 43690, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 48059, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 4369, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 8738, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 0, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 0, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 0, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 0, buffer.readUnsignedShort()); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
@Test public void testSerialize() { MatchEntryBuilder builder = prepareMatchEntry(false, "::aaaa:bbbb:1111:2222"); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, false); Assert.assertEquals("Wrong ipv6 address", 0, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 0, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 0, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 0, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 43690, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 48059, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 4369, buffer.readUnsignedShort()); Assert.assertEquals("Wrong ipv6 address", 8738, buffer.readUnsignedShort()); assertTrue("Unexpected data", buffer.readableBytes() == 0); }