### Question:
GyroErrorListener extends BaseErrorListener { @Override public void syntaxError( Recognizer<?, ?> recognizer, Object symbol, int line, int column, String message, RecognitionException error) { syntaxErrors.add(symbol instanceof Token ? new SyntaxError(stream, message, (Token) symbol) : new SyntaxError(stream, message, line - 1, column)); } GyroErrorListener(GyroCharStream stream); List<SyntaxError> getSyntaxErrors(); @Override void syntaxError(
        Recognizer<?, ?> recognizer,
        Object symbol,
        int line,
        int column,
        String message,
        RecognitionException error);  }### Answer:
@Test void syntaxErrorNull() { listener.syntaxError(null, null, 10, 20, MESSAGE, null); assertListener(9, 20, 9, 20); }
@Test void syntaxErrorToken() { Token token = mock(Token.class); when(token.getLine()).thenReturn(10); when(token.getCharPositionInLine()).thenReturn(20); when(token.getStartIndex()).thenReturn(-1); when(token.getStopIndex()).thenReturn(-1); listener.syntaxError(null, token, 0, 0, MESSAGE, null); assertListener(9, 20, 9, 20); }
@Test void syntaxErrorTokenStartStop() { Token token = mock(Token.class); when(token.getLine()).thenReturn(10); when(token.getCharPositionInLine()).thenReturn(20); when(token.getStartIndex()).thenReturn(30); when(token.getStopIndex()).thenReturn(40); listener.syntaxError(null, token, 0, 0, MESSAGE, null); assertListener(9, 20, 9, 30); }