### Question:
OxmIpv4SrcSerializer extends AbstractOxmIpv4AddressSerializer { @Override public void serialize(final MatchEntry entry, final ByteBuf outBuffer) { super.serialize(entry, outBuffer); Ipv4SrcCase entryValue = (Ipv4SrcCase) entry.getMatchEntryValue(); writeIpv4Address(entryValue.getIpv4Src().getIpv4Address(), outBuffer); if (entry.isHasMask()) { writeMask(entryValue.getIpv4Src().getMask(), outBuffer, EncodeConstants.GROUPS_IN_IPV4_ADDRESS); } }  @Override void serialize(final MatchEntry entry, final ByteBuf outBuffer);  }### Answer:
@Test public void testSerializeWithoutMask() { MatchEntryBuilder builder = prepareMatchEntry(false, "10.0.0.1"); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, false); byte[] address = new byte[4]; buffer.readBytes(address); Assert.assertArrayEquals("Wrong address", new byte[]{10, 0, 0, 1}, address); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
@Test public void testSerializeWithMask() { MatchEntryBuilder builder = prepareMatchEntry(true, "120.121.122.0"); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, true); byte[] address = new byte[4]; buffer.readBytes(address); Assert.assertArrayEquals("Wrong address", new byte[]{120, 121, 122, 0}, address); byte[] tmp = new byte[4]; buffer.readBytes(tmp); Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0}, tmp); assertTrue("Unexpected data", buffer.readableBytes() == 0); }