From a3a7620d6cb63eda65cc95ab55863aadece5d246 Mon Sep 17 00:00:00 2001 From: SteLeo1602 Date: Mon, 1 Jul 2024 20:21:09 -0700 Subject: [PATCH] Issue #11446: Updated testUnmappableCharacters in CheckerTest --- .../puppycrawl/tools/checkstyle/CheckerTest.java | 13 +++---------- .../checkstyle/checker/InputCheckerTestCharset.java | 12 +++++++++++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java index 00c5bad8c07..f5cbcf5caf8 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java @@ -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. @@ -1656,20 +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), + "14: " + getCheckMessage(LineLengthCheck.class, MSG_KEY, 80, 225), }; - 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 diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checker/InputCheckerTestCharset.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checker/InputCheckerTestCharset.java index acbae4392f5..8857fe41341 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checker/InputCheckerTestCharset.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checker/InputCheckerTestCharset.java @@ -1,5 +1,15 @@ +/*xml + + + + + + +*/ + package com.puppycrawl.tools.checkstyle.checker; public class InputCheckerTestCharset { - String a = "ᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀ"; // violation + // violation below + String a = "ᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀᾀ"; }