Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #11446: Update CheckerTest method testUnmappableCharacters #14821

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/suppressions.xml
Expand Up @@ -15,6 +15,8 @@
files="TokenTypes.java|IndentationCheckTest.java|XdocsPagesTest|CheckerTest.java"
lines="1"/>

<suppress checks="LineLength" files="CheckerTest.java"/>

<!-- illegal words are part of Javadoc -->
<suppress checks="TodoComment" files=".*TodoCommentCheck\.java"/>

Expand Down
14 changes: 3 additions & 11 deletions src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java
Expand Up @@ -84,7 +84,6 @@
import com.puppycrawl.tools.checkstyle.internal.utils.CloseAndFlushTestByteArrayOutputStream;
import com.puppycrawl.tools.checkstyle.internal.utils.TestUtil;
import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
import de.thetaphi.forbiddenapis.SuppressForbidden;

/**
* CheckerTest.
Expand Down Expand Up @@ -1656,21 +1655,14 @@ public void testCachedFile() throws Exception {
checker.destroy();
}

@SuppressForbidden
@Test
public void testUnmappableCharacters() throws Exception {
final String[] expected = {
"4: " + getCheckMessage(LineLengthCheck.class, MSG_KEY, 75, 238),
"13: " + getCheckMessage(LineLengthCheck.class, MSG_KEY, 80, 100),
};

final DefaultConfiguration checkConfig = createModuleConfig(LineLengthCheck.class);
checkConfig.addProperty("max", "75");

final DefaultConfiguration checkerConfig = createRootConfig(checkConfig);
checkerConfig.addProperty("charset", "IBM1098");

verify(checkerConfig, getPath("InputCheckerTestCharset.java"), expected);
}
verifyWithInlineXmlConfig(getPath("InputCheckerTestCharset.java"), expected);
}

@Test
public void testViolationMessageOnIoException() throws Exception {
Expand Down
@@ -1,3 +1,12 @@
/*xml
<module name="Checker">
<module name="com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck">
<property name="max" value="80"/>
</module>
<property name="charset" value="IBM1098"/>
</module>
*/

package com.puppycrawl.tools.checkstyle.checker;

public class InputCheckerTestCharset {
Expand Down