### Question:
LCmp extends Instruction implements MappableInstruction { @Override public boolean isSame(InstructionContext thisIc, InstructionContext otherIc) { if (thisIc.getInstruction().getType() != otherIc.getInstruction().getType()) { return false; } List<Field> f1s = getComparedFields(thisIc), f2s = getComparedFields(otherIc); if ((f1s == null) != (f2s == null)) { return false; } if (f1s == null || f2s == null) { return true; } if (f1s.size() != f2s.size()) { return false; } for (int i = 0; i < f1s.size(); ++i) { Field f1 = f1s.get(i), f2 = f2s.get(i); if (!MappingExecutorUtil.isMaybeEqual(f1.getClassFile(), f2.getClassFile()) || !MappingExecutorUtil.isMaybeEqual(f1.getType(), f2.getType()) || f1.isStatic() != f2.isStatic()) { return false; } } return true; } LCmp(Instructions instructions, InstructionType type); @Override InstructionContext execute(Frame frame); @Override void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other); @Override boolean isSame(InstructionContext thisIc, InstructionContext otherIc); @Override boolean canMap(InstructionContext thisIc);  }### Answer:
@Test public void testIsSame() { LCmp cmp = new LCmp(mock(Instructions.class), InstructionType.LCMP); LCmp cmp2 = new LCmp(mock(Instructions.class), InstructionType.LCMP); Frame f1 = mock(Frame.class); when(f1.getStack()).thenReturn(new Stack(42)); when(f1.getVariables()).thenReturn(new Variables(42)); Frame f2 = mock(Frame.class); when(f2.getStack()).thenReturn(new Stack(42)); when(f2.getVariables()).thenReturn(new Variables(42)); InstructionContext ctx1 = new InstructionContext(cmp, f1); InstructionContext ctx2 = new InstructionContext(cmp2, f2); boolean result = cmp.isSame(ctx1, ctx2); Assert.assertTrue(result); }