### Question:
CodeKeyMakerFactory { public static CodeKeyMaker createMatchEntriesKeyMaker(short version) { return new AbstractCodeKeyMaker(version) { @Override public MessageCodeKey make(ByteBuf input) { int oxmClass = input.getUnsignedShort(input.readerIndex()); int oxmField = input.getUnsignedByte(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1; MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(getVersion(), oxmClass, oxmField); if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) { long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES); key.setExperimenterId(expId); return key; } key.setExperimenterId(null); return key; } }; } private  CodeKeyMakerFactory(); static CodeKeyMaker createMatchEntriesKeyMaker(short version); static CodeKeyMaker createActionsKeyMaker(short version); static CodeKeyMaker createInstructionsKeyMaker(short version);  }### Answer:
@Test public void testMatchEntriesKeyMaker() { CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID); Assert.assertNotNull("Null key maker", keyMaker); ByteBuf buffer = BufferHelper.buildBuffer("80 00 00 04 00 00 00 01"); buffer.skipBytes(4); MessageCodeKey codeKey = keyMaker.make(buffer); Assert.assertNotNull("Null key", codeKey); Assert.assertEquals("Wrong key", new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 32768, 0), codeKey); Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes()); }
@Test public void testExperimenterMatchEntriesKeyMaker() { CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID); Assert.assertNotNull("Null key maker", keyMaker); ByteBuf buffer = BufferHelper.buildBuffer("FF FF 00 04 00 00 00 01"); buffer.skipBytes(4); MessageCodeKey codeKey = keyMaker.make(buffer); Assert.assertNotNull("Null key", codeKey); MatchEntryDeserializerKey comparationKey = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 65535, 0); comparationKey.setExperimenterId(1L); Assert.assertEquals("Wrong key", comparationKey, codeKey); Assert.assertEquals("Buffer index modified", 8, buffer.readableBytes()); }