### Question:
OxmArpShaSerializer extends AbstractOxmMacAddressSerializer { @Override public void serialize(MatchEntry entry, ByteBuf outBuffer) { super.serialize(entry, outBuffer); ArpShaCase entryValue = (ArpShaCase) entry.getMatchEntryValue(); writeMacAddress(entryValue.getArpSha().getMacAddress(), outBuffer); if (entry.isHasMask()) { writeMask(entryValue.getArpSha().getMask(), outBuffer, EncodeConstants.MAC_ADDRESS_LENGTH); } }  @Override void serialize(MatchEntry entry, ByteBuf outBuffer);  }### Answer:
@Test public void testSerializeWithoutMask() { MatchEntryBuilder builder = prepareMatchEntry(false, "00:01:02:03:04:05"); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, false); byte[] address = new byte[6]; buffer.readBytes(address); Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 5}, address); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
@Test public void testSerializeWithMask() { MatchEntryBuilder builder = prepareMatchEntry(true, "00:01:02:03:04:0A"); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, true); byte[] address = new byte[6]; buffer.readBytes(address); Assert.assertArrayEquals("Wrong address", new byte[]{0, 1, 2, 3, 4, 10}, address); byte[] tmp = new byte[6]; buffer.readBytes(tmp); Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15, 0, 0, 10, 10}, tmp); assertTrue("Unexpected data", buffer.readableBytes() == 0); }