### Question:
TypeKeyMakerFactory { public static TypeKeyMaker<MatchEntry> createMatchEntriesKeyMaker(short version) { return new AbstractTypeKeyMaker<MatchEntry>(version) { @Override public MatchEntrySerializerKey<?, ?> make(MatchEntry entry) { MatchEntrySerializerKey<?, ?> key; key = new MatchEntrySerializerKey<>(getVersion(), entry.getOxmClass(), entry.getOxmMatchField()); if (entry.getOxmClass().equals(ExperimenterClass.class)) { ExperimenterIdCase entryValue = (ExperimenterIdCase) entry.getMatchEntryValue(); key.setExperimenterId(entryValue.getExperimenter().getExperimenter().getValue()); return key; } key.setExperimenterId(null); return key; } }; } private  TypeKeyMakerFactory(); static TypeKeyMaker<MatchEntry> createMatchEntriesKeyMaker(short version); static TypeKeyMaker<Action> createActionKeyMaker(short version); static TypeKeyMaker<Instruction> createInstructionKeyMaker(short version);  }### Answer:
@Test public void testMatchEntriesKeyMaker() { TypeKeyMaker<MatchEntry> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID); Assert.assertNotNull("Null keyMaker", keyMaker); MatchEntryBuilder builder = new MatchEntryBuilder(); builder.setOxmClass(OpenflowBasicClass.class); builder.setOxmMatchField(InPort.class); builder.setHasMask(true); MatchEntry entry = builder.build(); MessageTypeKey<?> key = keyMaker.make(entry); Assert.assertNotNull("Null key", key); MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class); Assert.assertEquals("Wrong key", comparationKey, key); }
@Test public void testExperimenterMatchEntriesKeyMaker() { TypeKeyMaker<MatchEntry> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID); Assert.assertNotNull("Null keyMaker", keyMaker); MatchEntryBuilder builder = new MatchEntryBuilder(); builder.setOxmClass(ExperimenterClass.class); builder.setOxmMatchField(OxmMatchFieldClass.class); builder.setHasMask(true); ExperimenterIdCaseBuilder caseBuilder = new ExperimenterIdCaseBuilder(); ExperimenterBuilder expBuilder = new ExperimenterBuilder(); expBuilder.setExperimenter(new ExperimenterId(42L)); caseBuilder.setExperimenter(expBuilder.build()); builder.setMatchEntryValue(caseBuilder.build()); MatchEntry entry = builder.build(); MessageTypeKey<?> key = keyMaker.make(entry); Assert.assertNotNull("Null key", key); MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, OxmMatchFieldClass.class); comparationKey.setExperimenterId(42L); Assert.assertEquals("Wrong key", comparationKey, key); }