@Test public void testQueriesAndCleanUp() { final SUL<Character, Integer> mock = Mockito.spy(sul); final SULSymbolQueryOracle<Character, Integer> oracle = new SULSymbolQueryOracle<>(mock); Mockito.verify(mock, Mockito.times(0)).pre(); Mockito.verify(mock, Mockito.times(0)).post(); final Word<Character> i1 = Word.fromCharSequence("abcabcabc"); final Word<Integer> o1 = oracle.answerQuery(i1); oracle.reset(); Assert.assertEquals(o1, example.getReferenceAutomaton().computeOutput(i1)); Mockito.verify(mock, Mockito.times(1)).pre(); Mockito.verify(mock, Mockito.times(1)).post(); Mockito.verify(mock, Mockito.times(i1.size())).step(Mockito.anyChar()); final Word<Character> i2 = Word.fromCharSequence("cba"); final Word<Integer> o2 = oracle.answerQuery(i2); oracle.reset(); oracle.reset(); Assert.assertEquals(o2, example.getReferenceAutomaton().computeOutput(i2)); Mockito.verify(mock, Mockito.times(2)).pre(); Mockito.verify(mock, Mockito.times(2)).post(); Mockito.verify(mock, Mockito.times(i1.size() + i2.size())).step(Mockito.anyChar()); }
@Override public void reset() { if (postRequired) { this.sul.post(); this.postRequired = false; } this.preRequired = true; }
SULSymbolQueryOracle implements SymbolQueryOracle<I, O> { @Override public void reset() { if (postRequired) { this.sul.post(); this.postRequired = false; } this.preRequired = true; } }
SULSymbolQueryOracle implements SymbolQueryOracle<I, O> { @Override public void reset() { if (postRequired) { this.sul.post(); this.postRequired = false; } this.preRequired = true; } SULSymbolQueryOracle(final SUL<I, O> sul); }
SULSymbolQueryOracle implements SymbolQueryOracle<I, O> { @Override public void reset() { if (postRequired) { this.sul.post(); this.postRequired = false; } this.preRequired = true; } SULSymbolQueryOracle(final SUL<I, O> sul); @Override O query(I i); @Override void reset(); }
SULSymbolQueryOracle implements SymbolQueryOracle<I, O> { @Override public void reset() { if (postRequired) { this.sul.post(); this.postRequired = false; } this.preRequired = true; } SULSymbolQueryOracle(final SUL<I, O> sul); @Override O query(I i); @Override void reset();  }