### Question:
GyroErrorStrategy extends DefaultErrorStrategy { @Override protected void reportMissingToken(Parser recognizer) { if (inErrorRecoveryMode(recognizer)) { return; } beginErrorCondition(recognizer); recognizer.notifyErrorListeners( recognizer.getCurrentToken(), "Missing " + getExpectedTokens(recognizer).toString(recognizer.getVocabulary()), null); }   static final GyroErrorStrategy INSTANCE; }### Answer:
@Test void reportMissingToken() { when(recognizer.getCurrentToken()).thenReturn(token); when(recognizer.getExpectedTokens()).thenReturn(set); when(set.toString(any(Vocabulary.class))).thenReturn("foo"); when(recognizer.getVocabulary()).thenReturn(mock(Vocabulary.class)); strategy.reportMissingToken(recognizer); assertThat(strategy.inErrorRecoveryMode(recognizer)).isTrue(); verify(recognizer).notifyErrorListeners(token, "Missing foo", null); }
@Test void reportMissingTokenInRecovery() { doReturn(true).when(strategy).inErrorRecoveryMode(recognizer); strategy.reportMissingToken(recognizer); verifyNoMoreInteractions(recognizer); }