Instruction { public static Instruction predicateChoice(int offset) { return new PredicateChoiceInstruction(offset); }  static void addAll(List<Instruction> list, Instruction[] array); static Instruction jump(int offset); static Instruction call(int offset, Matcher matcher); static Instruction ret(); static Instruction backtrack(); static Instruction end(); static Instruction choice(int offset); static Instruction predicateChoice(int offset); static Instruction commit(int offset); static Instruction commitVerify(int offset); static Instruction failTwice(); static Instruction backCommit(int offset); static Instruction ignoreErrors(); abstract void execute(Machine machine);  }
@Test public void predicateChoice() { Instruction instruction = Instruction.predicateChoice(42); assertThat(instruction).isInstanceOf(PredicateChoiceInstruction.class); assertThat(instruction.toString()).isEqualTo("PredicateChoice 42"); assertThat(instruction.equals(Instruction.predicateChoice(42))).isTrue(); assertThat(instruction.equals(Instruction.predicateChoice(13))).isFalse(); assertThat(instruction.equals(new Object())).isFalse(); assertThat(instruction.hashCode()).isEqualTo(42); instruction.execute(machine); InOrder inOrder = Mockito.inOrder(machine); inOrder.verify(machine).pushBacktrack(42); inOrder.verify(machine).setIgnoreErrors(true); inOrder.verify(machine).jump(1); verifyNoMoreInteractions(machine); }