### Question:
OxmVlanVidSerializer extends AbstractOxmMatchEntrySerializer { @Override public void serialize(MatchEntry entry, ByteBuf outBuffer) { super.serialize(entry, outBuffer); VlanVid vlanVid = ((VlanVidCase) entry.getMatchEntryValue()).getVlanVid(); int vlanVidValue = vlanVid.getVlanVid(); if (vlanVid.isCfiBit()) { short cfi = 1 << 12; vlanVidValue = vlanVidValue | cfi; } outBuffer.writeShort(vlanVidValue); if (entry.isHasMask()) { writeMask(vlanVid.getMask(), outBuffer, getValueLength()); } }  @Override void serialize(MatchEntry entry, ByteBuf outBuffer);  }### Answer:
@Test public void testSerializeWithCfiBitSet() { MatchEntryBuilder builder = prepareVlanVidMatchEntry(false, true); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, false); assertEquals("Wrong value", 4596, buffer.readUnsignedShort()); assertTrue("Unexpected data", buffer.readableBytes() == 0); }
@Test public void testSerializeWithoutCfiBitSet() { MatchEntryBuilder builder = prepareVlanVidMatchEntry(true, false); ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, true); assertEquals("Wrong value", 500, buffer.readUnsignedShort()); byte[] tmp = new byte[2]; buffer.readBytes(tmp); Assert.assertArrayEquals("Wrong mask", new byte[]{15, 15}, tmp); assertTrue("Unexpected data", buffer.readableBytes() == 0); }