### Question:
AnnotationParser { private void expect(AnnotationTokens token) { if (lexer.token == token) { lexer.nextToken(); } else { long pos = AnnotationElement.line(lexer.pos) > AnnotationElement.line(lexer.lastPos) ? lexer.lastPos : lexer.pos; throw new AnnotationParserException(String.format("Error: %s: %s expected", AnnotationElement.positionToString(pos), token.text)); } } AnnotationParser(String input, boolean expectDocNoise); List<AnnotationElement.Annotation> parse();  }### Answer:
@Test public void testAnnotationsMustStartOnAnEmptyLine() { exception.expect(AnnotationParserException.class); exception.expectMessage("Error: 4,7: Annotations must start on an empty line"); testAnnotationParsing( "some garbage \n" + "\n" + "more garbage\n" + " aaa @Abc\n" + "\n", true, "@Abc(\n)\n"); }
@Test public void testUnexpectedShmoo() { exception.expect(AnnotationParserException.class); exception.expectMessage("Error: 1,1: Unexpected character: x"); testAnnotationParsing( "xx\n" + " @Abc \n" + "\n", false, "@Abc(\n)\n"); }