Skip to content

Commit

Permalink
Issue #4395: kill last mutation in pitest-checkstyle-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimfadora authored and romani committed Aug 31, 2017
1 parent 2f4eae8 commit a7a5f55
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 0 additions & 4 deletions pom.xml
Expand Up @@ -2278,10 +2278,6 @@
<param>com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilterTest</param>
<param>com.puppycrawl.tools.checkstyle.internal.AllChecksTest</param>
</targetTests>
<excludedMethods>
<!-- till https://github.com/checkstyle/checkstyle/issues/4395 -->
<param>getTokenName</param>
</excludedMethods>
<mutationThreshold>100</mutationThreshold>
<timeoutFactor>${pitest.plugin.timeout.factor}</timeoutFactor>
<timeoutConstant>${pitest.plugin.timeout.constant}</timeoutConstant>
Expand Down
Expand Up @@ -343,7 +343,7 @@ public static String getTokenName(int id) {
if (id == JavadocTokenTypes.EOF) {
name = "EOF";
}
else if (id > TOKEN_VALUE_TO_NAME.length - 1) {
else if (id >= TOKEN_VALUE_TO_NAME.length) {
throw new IllegalArgumentException(UNKNOWN_JAVADOC_TOKEN_ID_EXCEPTION_MESSAGE + id);
}
else {
Expand Down
Expand Up @@ -278,6 +278,18 @@ public void testGetTokenNameForInvalidId() {
}
}

@Test
public void testGetTokenNameForLowerBoundInvalidId() {
try {
JavadocUtils.getTokenName(20079);
fail("exception expected");
}
catch (IllegalArgumentException ex) {
assertEquals("Invalid exception message",
"Unknown javadoc token id. Given id: 20079", ex.getMessage());
}
}

@Test
public void testGetTokenIdThatIsUnknown() {
try {
Expand Down

0 comments on commit a7a5f55

Please sign in to comment.