diff --git a/src/test/java/org/checkstyle/autofix/recipe/AbstractRecipeTestSupport.java b/src/test/java/org/checkstyle/autofix/recipe/AbstractRecipeTestSupport.java index 500e47a..79a9937 100644 --- a/src/test/java/org/checkstyle/autofix/recipe/AbstractRecipeTestSupport.java +++ b/src/test/java/org/checkstyle/autofix/recipe/AbstractRecipeTestSupport.java @@ -45,8 +45,6 @@ public abstract class AbstractRecipeTestSupport extends AbstractXmlTestSupport protected abstract String getSubpackage(); - protected abstract String getCheckName(); - protected abstract Recipe createRecipe(List violations); @Override diff --git a/src/test/java/org/checkstyle/autofix/recipe/UpperEllTest.java b/src/test/java/org/checkstyle/autofix/recipe/UpperEllTest.java index 59e2453..a2c5132 100644 --- a/src/test/java/org/checkstyle/autofix/recipe/UpperEllTest.java +++ b/src/test/java/org/checkstyle/autofix/recipe/UpperEllTest.java @@ -17,46 +17,43 @@ package org.checkstyle.autofix.recipe; -import java.io.IOException; -import java.nio.file.Path; import java.util.List; -import org.checkstyle.autofix.parser.CheckstyleReportParser; import org.checkstyle.autofix.parser.CheckstyleViolation; import org.junit.jupiter.api.Test; import org.openrewrite.Recipe; -import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +public class UpperEllTest extends AbstractRecipeTestSupport { -public class UpperEllTest extends AbstractRecipeTest { + @Override + protected String getSubpackage() { + return "upperell"; + } @Override - protected Recipe getRecipe() { - final String reportPath = "src/test/resources/org/checkstyle/autofix/recipe/upperell" - + "/report.xml"; + protected Recipe createRecipe(List violations) { - final List violations = - CheckstyleReportParser.parse(Path.of(reportPath)); return new UpperEll(violations); } @Test - void hexOctalLiteralTest() throws IOException, CheckstyleException { - testRecipe("upperell", "HexOctalLiteral"); + void hexOctalLiteral() throws Exception { + verify("HexOctalLiteral"); } @Test - void complexLongLiterals() throws IOException, CheckstyleException { - testRecipe("upperell", "ComplexLongLiterals"); + void complexLongLiterals() throws Exception { + verify("ComplexLongLiterals"); } @Test - void stringAndCommentTest() throws IOException, CheckstyleException { - testRecipe("upperell", "StringAndComments"); + void stringAndComments() throws Exception { + verify("StringAndComments"); } @Test - void symbolicLiteralTest() throws IOException, CheckstyleException { - testRecipe("upperell", "SymbolicLiterals"); + void symbolicLiteral() throws Exception { + verify("SymbolicLiterals"); } + } diff --git a/src/test/resources/org/checkstyle/autofix/recipe/upperell/complexlongliterals/InputComplexLongLiterals.java b/src/test/resources/org/checkstyle/autofix/recipe/upperell/complexlongliterals/InputComplexLongLiterals.java index 6b4051a..09573a1 100644 --- a/src/test/resources/org/checkstyle/autofix/recipe/upperell/complexlongliterals/InputComplexLongLiterals.java +++ b/src/test/resources/org/checkstyle/autofix/recipe/upperell/complexlongliterals/InputComplexLongLiterals.java @@ -1,11 +1,25 @@ +/*xml + + + + + + + + + + +*/ + package org.checkstyle.autofix.recipe.upperell.complexlongliterals; public class InputComplexLongLiterals { private long withUnderscores = 1_000_000l; private long multipleUnderscores = 1_234_567_890l; - private long maxLong = 9223372036854775807l; - private long minLong = -9223372036854775808l; + private long maxLong = 9223372036854775807l; //suppressed violation + private long minLong = -9223372036854775808l; //suppressed violation private Long nullLong = null; private Long simpleLong = 1234l; diff --git a/src/test/resources/org/checkstyle/autofix/recipe/upperell/complexlongliterals/OutputComplexLongLiterals.java b/src/test/resources/org/checkstyle/autofix/recipe/upperell/complexlongliterals/OutputComplexLongLiterals.java index ebe86a0..5443392 100644 --- a/src/test/resources/org/checkstyle/autofix/recipe/upperell/complexlongliterals/OutputComplexLongLiterals.java +++ b/src/test/resources/org/checkstyle/autofix/recipe/upperell/complexlongliterals/OutputComplexLongLiterals.java @@ -1,11 +1,25 @@ +/*xml + + + + + + + + + + +*/ + package org.checkstyle.autofix.recipe.upperell.complexlongliterals; public class OutputComplexLongLiterals { private long withUnderscores = 1_000_000L; private long multipleUnderscores = 1_234_567_890L; - private long maxLong = 9223372036854775807L; - private long minLong = -9223372036854775808L; + private long maxLong = 9223372036854775807l; //suppressed violation + private long minLong = -9223372036854775808l; //suppressed violation private Long nullLong = null; private Long simpleLong = 1234L; diff --git a/src/test/resources/org/checkstyle/autofix/recipe/upperell/hexoctalliteral/InputHexOctalLiteral.java b/src/test/resources/org/checkstyle/autofix/recipe/upperell/hexoctalliteral/InputHexOctalLiteral.java index fbaf30c..1af3198 100644 --- a/src/test/resources/org/checkstyle/autofix/recipe/upperell/hexoctalliteral/InputHexOctalLiteral.java +++ b/src/test/resources/org/checkstyle/autofix/recipe/upperell/hexoctalliteral/InputHexOctalLiteral.java @@ -1,3 +1,16 @@ +/*xml + + + + + + + + + + +*/ + package org.checkstyle.autofix.recipe.upperell.hexoctalliteral; public class InputHexOctalLiteral { @@ -9,7 +22,7 @@ public class InputHexOctalLiteral { public void calculateValues() { long hexResult = 0xDEADBEEFl + 0xDEADBEFl; //suppressed violation for 0xDEADBEFl - long octalResult = 01234l + 0xDEADBEEFl; //suppressed violation for 0xDEADBEFl + long octalResult = 01234l + 0xDEADBEEFl; //suppressed violation for 01234l long binaryResult = 0b11110000l; } } diff --git a/src/test/resources/org/checkstyle/autofix/recipe/upperell/hexoctalliteral/OutputHexOctalLiteral.java b/src/test/resources/org/checkstyle/autofix/recipe/upperell/hexoctalliteral/OutputHexOctalLiteral.java index 840f57a..7764897 100644 --- a/src/test/resources/org/checkstyle/autofix/recipe/upperell/hexoctalliteral/OutputHexOctalLiteral.java +++ b/src/test/resources/org/checkstyle/autofix/recipe/upperell/hexoctalliteral/OutputHexOctalLiteral.java @@ -1,3 +1,16 @@ +/*xml + + + + + + + + + + +*/ + package org.checkstyle.autofix.recipe.upperell.hexoctalliteral; public class OutputHexOctalLiteral { @@ -9,7 +22,7 @@ public class OutputHexOctalLiteral { public void calculateValues() { long hexResult = 0xDEADBEEFL + 0xDEADBEFl; //suppressed violation for 0xDEADBEFl - long octalResult = 01234L + 0xDEADBEEFl; //suppressed violation for 0xDEADBEFl + long octalResult = 01234l + 0xDEADBEEFL; //suppressed violation for 01234l long binaryResult = 0b11110000L; } } diff --git a/src/test/resources/org/checkstyle/autofix/recipe/upperell/report.xml b/src/test/resources/org/checkstyle/autofix/recipe/upperell/report.xml deleted file mode 100644 index 61aaebb..0000000 --- a/src/test/resources/org/checkstyle/autofix/recipe/upperell/report.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/org/checkstyle/autofix/recipe/upperell/stringandcomments/InputStringAndComments.java b/src/test/resources/org/checkstyle/autofix/recipe/upperell/stringandcomments/InputStringAndComments.java index 5929572..8ad1a22 100644 --- a/src/test/resources/org/checkstyle/autofix/recipe/upperell/stringandcomments/InputStringAndComments.java +++ b/src/test/resources/org/checkstyle/autofix/recipe/upperell/stringandcomments/InputStringAndComments.java @@ -1,3 +1,12 @@ +/*xml + + + + + + +*/ + package org.checkstyle.autofix.recipe.upperell.stringandcomments; public class InputStringAndComments { diff --git a/src/test/resources/org/checkstyle/autofix/recipe/upperell/stringandcomments/OutputStringAndComments.java b/src/test/resources/org/checkstyle/autofix/recipe/upperell/stringandcomments/OutputStringAndComments.java index cf274a1..bdf6e48 100644 --- a/src/test/resources/org/checkstyle/autofix/recipe/upperell/stringandcomments/OutputStringAndComments.java +++ b/src/test/resources/org/checkstyle/autofix/recipe/upperell/stringandcomments/OutputStringAndComments.java @@ -1,3 +1,12 @@ +/*xml + + + + + + +*/ + package org.checkstyle.autofix.recipe.upperell.stringandcomments; public class OutputStringAndComments { diff --git a/src/test/resources/org/checkstyle/autofix/recipe/upperell/symbolicliterals/InputSymbolicLiterals.java b/src/test/resources/org/checkstyle/autofix/recipe/upperell/symbolicliterals/InputSymbolicLiterals.java index b256b99..905d924 100644 --- a/src/test/resources/org/checkstyle/autofix/recipe/upperell/symbolicliterals/InputSymbolicLiterals.java +++ b/src/test/resources/org/checkstyle/autofix/recipe/upperell/symbolicliterals/InputSymbolicLiterals.java @@ -1,3 +1,12 @@ +/*xml + + + + + + +*/ + package org.checkstyle.autofix.recipe.upperell.symbolicliterals; public class InputSymbolicLiterals { diff --git a/src/test/resources/org/checkstyle/autofix/recipe/upperell/symbolicliterals/OutputSymbolicLiterals.java b/src/test/resources/org/checkstyle/autofix/recipe/upperell/symbolicliterals/OutputSymbolicLiterals.java index 2e24b54..a19b233 100644 --- a/src/test/resources/org/checkstyle/autofix/recipe/upperell/symbolicliterals/OutputSymbolicLiterals.java +++ b/src/test/resources/org/checkstyle/autofix/recipe/upperell/symbolicliterals/OutputSymbolicLiterals.java @@ -1,3 +1,12 @@ +/*xml + + + + + + +*/ + package org.checkstyle.autofix.recipe.upperell.symbolicliterals; public class OutputSymbolicLiterals {