### Question:
TypeKeyMakerFactory { public static TypeKeyMaker<Instruction> createInstructionKeyMaker(short version) { return new AbstractTypeKeyMaker<Instruction>(version) { @Override public MessageTypeKey<?> make(Instruction entry) { if (entry.getExperimenterId() != null) { return new InstructionSerializerKey<>(getVersion(), (Class<InstructionChoice>) entry.getInstructionChoice().getImplementedInterface(), entry.getExperimenterId().getValue()); } return new InstructionSerializerKey<>(getVersion(), (Class<InstructionChoice>) entry.getInstructionChoice().getImplementedInterface(), null); } }; } private  TypeKeyMakerFactory(); static TypeKeyMaker<MatchEntry> createMatchEntriesKeyMaker(short version); static TypeKeyMaker<Action> createActionKeyMaker(short version); static TypeKeyMaker<Instruction> createInstructionKeyMaker(short version);  }### Answer:
@Test public void testInstructionKeyMaker() { TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID); Assert.assertNotNull("Null keyMaker", keyMaker); InstructionBuilder builder = new InstructionBuilder(); builder.setInstructionChoice(new GotoTableCaseBuilder().build()); Instruction instruction = builder.build(); MessageTypeKey<?> key = keyMaker.make(instruction); Assert.assertNotNull("Null key", key); Assert.assertEquals("Wrong key", new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, GotoTableCase.class, null), key); }
@Test public void testExperimenterInstructionKeyMaker() { TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID); Assert.assertNotNull("Null keyMaker", keyMaker); InstructionBuilder builder = new InstructionBuilder(); builder.setExperimenterId(new ExperimenterId(42L)); builder.setInstructionChoice(new ClearActionsCaseBuilder().build()); Instruction instruction = builder.build(); MessageTypeKey<?> key = keyMaker.make(instruction); Assert.assertNotNull("Null key", key); Assert.assertEquals("Wrong key", new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, ClearActionsCase.class, 42L), key); }