Skip to content

Commit

Permalink
Issue checkstyle#3567: fixed final ForbidAnnotationElementValueCheck …
Browse files Browse the repository at this point in the history
…violation
  • Loading branch information
rnveach authored and romani committed Feb 15, 2019
1 parent d5e6444 commit 4161929
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -654,8 +654,7 @@ public void testMultiplePatternMatches() throws Exception {
*
* @throws Exception if there is an error.
*/
// -@cs[ForbidAnnotationElementValue] Will examine turkish failure
@Test(expected = IllegalStateException.class)
@Test
public void testVisitTokenSwitchReflection() throws Exception {
// Create mock ast
final DetailAST astImport = mockAST(TokenTypes.IMPORT, "import", "mockfile", 0, 0);
Expand All @@ -669,7 +668,13 @@ public void testVisitTokenSwitchReflection() throws Exception {
TestUtil.getClassDeclaredField(ImportOrderCheck.class, "option").set(mock, null);

// expecting IllegalStateException
mock.visitToken(astImport);
try {
mock.visitToken(astImport);
fail("An exception is expected");
}
catch (IllegalStateException ex) {
assertTrue("invalid exception message", ex.getMessage().endsWith(": null"));
}
}

/**
Expand Down

0 comments on commit 4161929

Please sign in to comment.