diff --git a/.github/actions/test-plugin-installation/Dockerfile b/.github/actions/test-plugin-installation/Dockerfile
index 31fb5cb..5950875 100644
--- a/.github/actions/test-plugin-installation/Dockerfile
+++ b/.github/actions/test-plugin-installation/Dockerfile
@@ -21,8 +21,7 @@
# The env variables below are implicitly created for the invoking GitHub action's input parameters
# See https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
ARG inputs_sonarqube_base_image
-ARG inputs_aem_rules_binary
-
FROM $inputs_sonarqube_base_image
+ARG inputs_aem_rules_binary
COPY $inputs_aem_rules_binary $SONARQUBE_HOME/extensions/plugins/$inputs_aem_rules_binary
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 233bd91..736ca4e 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -28,7 +28,7 @@ jobs:
strategy:
matrix:
- java-version: [ 11, 17 ]
+ java-version: [ 11 ]
steps:
- uses: actions/checkout@v4
diff --git a/local-docker-image/conf/sonar.properties b/local-docker-image/conf/sonar.properties
index e431a47..34ac760 100644
--- a/local-docker-image/conf/sonar.properties
+++ b/local-docker-image/conf/sonar.properties
@@ -446,4 +446,4 @@
# We don't collect source code or IP addresses. And we don't share the data with anyone else.
#sonar.telemetry.enable=true
-sonar.web.javaAdditionalOpts=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
+sonar.web.javaAdditionalOpts=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000
diff --git a/local-docker-image/docker-compose.yml b/local-docker-image/docker-compose.yml
index 6ce85ce..c7b55ba 100644
--- a/local-docker-image/docker-compose.yml
+++ b/local-docker-image/docker-compose.yml
@@ -27,7 +27,7 @@ services:
context: .
ports:
- "9000:9000"
- - "5005:5005"
+ - "8000:8000"
restart: unless-stopped
volumes:
- ./extensions/plugins:/opt/sonarqube/extensions/plugins:ro
diff --git a/pom.xml b/pom.xml
index bc7aef1..73519ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -112,7 +112,7 @@
10.7.0.96327
7.30.1.34514
11
- src/main/java,src/main/js
+ src/main/java
4rVf3NGV0jyQ3EGrc8L86oEDoHWm6MgDD
v${project.version}
@@ -215,40 +215,34 @@
${sonar.testingHarnessVersion}
- junit
- junit
+ junit-jupiter-api
+ org.junit.jupiter
test
- 4.13.2
+ 5.11.3
+
+
+ junit-jupiter-params
+ org.junit.jupiter
+ test
+ 5.11.3
mockito-core
org.mockito
test
- 5.12.0
+ 5.14.2
assertj-core
org.assertj
test
- 3.26.0
-
-
- fest-assert
- org.easytesting
- test
- 1.4
-
-
- hamcrest-all
- org.hamcrest
- test
- 1.3
+ 3.26.3
guava
com.google.guava
test
- 32.0.0-jre
+ 33.3.1-jre
sonar-plugin-api-impl
@@ -272,8 +266,9 @@
logback-classic
ch.qos.logback
test
- 1.2.13
+ 1.5.12
+
aem-api
com.adobe.aem
diff --git a/src/main/java/com/vml/aemrules/htl/lex/ElementTokenizer.java b/src/main/java/com/vml/aemrules/htl/lex/ElementTokenizer.java
index 88ba1f6..eb2975f 100644
--- a/src/main/java/com/vml/aemrules/htl/lex/ElementTokenizer.java
+++ b/src/main/java/com/vml/aemrules/htl/lex/ElementTokenizer.java
@@ -255,4 +255,4 @@ public boolean match(int character) {
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/vml/aemrules/java/checks/ModifiableValueMapUsageCheck.java b/src/main/java/com/vml/aemrules/java/checks/ModifiableValueMapUsageCheck.java
index 1e23327..5c74180 100644
--- a/src/main/java/com/vml/aemrules/java/checks/ModifiableValueMapUsageCheck.java
+++ b/src/main/java/com/vml/aemrules/java/checks/ModifiableValueMapUsageCheck.java
@@ -98,7 +98,7 @@ private void visitMethodWithMVM(IdentifierTree modifiableValueMapUsageIdentifier
int argumentNumber = ((Arguments) usageOfMVM).indexOf(modifiableValueMapUsageIdentifier);
MethodInvocationTree methodInvocationWithMVM = (MethodInvocationTree) usageOfMVM.parent();
if (methodInvocationWithMVM != null) {
- MethodTree methodWithMVM = (MethodTree) methodInvocationWithMVM.methodSymbol().declaration();
+ MethodTree methodWithMVM = methodInvocationWithMVM.methodSymbol().declaration();
if (methodWithMVM != null && methodWithMVM.is(Tree.Kind.METHOD)) {
MethodWithMVMVisitor methodWithMVMVisitor = new MethodWithMVMVisitor(this, argumentNumber);
methodWithMVM.accept(methodWithMVMVisitor);
@@ -128,4 +128,4 @@ public void visitMethod(MethodTree tree) {
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/vml/aemrules/java/checks/resourceresolver/close/FindRRDeclarationVisitor.java b/src/main/java/com/vml/aemrules/java/checks/resourceresolver/close/FindRRDeclarationVisitor.java
index b4be686..9b0971c 100644
--- a/src/main/java/com/vml/aemrules/java/checks/resourceresolver/close/FindRRDeclarationVisitor.java
+++ b/src/main/java/com/vml/aemrules/java/checks/resourceresolver/close/FindRRDeclarationVisitor.java
@@ -112,7 +112,7 @@ public void visitReturnStatement(ReturnStatementTree tree) {
IdentifierTree identifier = (IdentifierTree) tree.expression();
Tree declaration = identifier.symbol().declaration();
if (resourceResolvers.contains(declaration)) {
- resourceResolvers.remove(declaration);
+ resourceResolvers.remove(declaration);
}
}
super.visitReturnStatement(tree);
diff --git a/src/main/java/com/vml/aemrules/java/checks/visitors/FindSessionDeclarationVisitor.java b/src/main/java/com/vml/aemrules/java/checks/visitors/FindSessionDeclarationVisitor.java
index f3dec06..6a01431 100644
--- a/src/main/java/com/vml/aemrules/java/checks/visitors/FindSessionDeclarationVisitor.java
+++ b/src/main/java/com/vml/aemrules/java/checks/visitors/FindSessionDeclarationVisitor.java
@@ -112,7 +112,7 @@ public void visitReturnStatement(ReturnStatementTree tree) {
IdentifierTree identifier = (IdentifierTree) tree.expression();
Tree declaration = getDeclaration(identifier);
if (sessions.contains(declaration)) {
- sessions.remove(declaration);
+ sessions.remove(declaration);
}
}
super.visitReturnStatement(tree);
@@ -188,4 +188,4 @@ public Tree getDeclarationOfReturnedVariable() {
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/vml/aemrules/utils/Throwables.java b/src/main/java/com/vml/aemrules/utils/Throwables.java
index 96cf2ae..0589a15 100644
--- a/src/main/java/com/vml/aemrules/utils/Throwables.java
+++ b/src/main/java/com/vml/aemrules/utils/Throwables.java
@@ -36,7 +36,7 @@ public static Throwable getRootCause(Throwable throwable) {
public static RuntimeException propagate(Throwable throwable) {
throwIfUnchecked(throwable);
- throw new RuntimeException(throwable);
+ throw new AemRulesTestRuntimeException(throwable);
}
public static void throwIfUnchecked(Throwable throwable) {
@@ -47,4 +47,10 @@ public static void throwIfUnchecked(Throwable throwable) {
throw (Error) throwable;
}
}
+
+ private static class AemRulesTestRuntimeException extends RuntimeException {
+ public AemRulesTestRuntimeException(Throwable throwable) {
+ super(throwable);
+ }
+ }
}
diff --git a/src/main/java/com/vml/aemrules/version/Version.java b/src/main/java/com/vml/aemrules/version/Version.java
index ff42769..2408296 100644
--- a/src/main/java/com/vml/aemrules/version/Version.java
+++ b/src/main/java/com/vml/aemrules/version/Version.java
@@ -27,7 +27,7 @@
public class Version {
- private static final Pattern VERSION_PATTERN = Pattern.compile("(?[0-9]+)\\.(?[0-9])");
+ private static final Pattern VERSION_PATTERN = Pattern.compile("(?\\d+)\\.(?\\d)");
private final int major;
diff --git a/src/test/java/com/vml/aemrules/AemRulesSonarPluginTest.java b/src/test/java/com/vml/aemrules/AemRulesSonarPluginTest.java
index 5733412..fb89a80 100644
--- a/src/test/java/com/vml/aemrules/AemRulesSonarPluginTest.java
+++ b/src/test/java/com/vml/aemrules/AemRulesSonarPluginTest.java
@@ -19,7 +19,7 @@
*/
package com.vml.aemrules;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.sonar.api.Plugin;
import org.sonar.api.SonarEdition;
import org.sonar.api.SonarQubeSide;
@@ -28,10 +28,10 @@
import static org.assertj.core.api.Assertions.assertThat;
-public class AemRulesSonarPluginTest {
+class AemRulesSonarPluginTest {
@Test
- public void webPluginTester() {
+ void webPluginTester() {
Plugin.Context context = new Plugin.Context(SonarRuntimeImpl.forSonarQube(Version.create(6, 7), SonarQubeSide.SERVER, SonarEdition.COMMUNITY));
new AemRulesSonarPlugin().define(context);
diff --git a/src/test/java/com/vml/aemrules/htl/HtlProfileTest.java b/src/test/java/com/vml/aemrules/htl/HtlProfileTest.java
index fe81953..2168802 100644
--- a/src/test/java/com/vml/aemrules/htl/HtlProfileTest.java
+++ b/src/test/java/com/vml/aemrules/htl/HtlProfileTest.java
@@ -19,9 +19,8 @@
*/
package com.vml.aemrules.htl;
-
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.BuiltInActiveRule;
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.BuiltInQualityProfile;
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.Context;
@@ -32,15 +31,15 @@
import java.util.function.Function;
import java.util.stream.Collectors;
-import static org.fest.assertions.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
-public class HtlProfileTest {
+class HtlProfileTest {
private HtlProfile profile;
private Context context;
- @Before
+ @BeforeEach
public void setUp() {
profile = new HtlProfile();
this.context = new Context();
@@ -48,7 +47,7 @@ public void setUp() {
}
@Test
- public void sanity() {
+ void sanity() {
profile.define(context);
Map activeRules = getActiveRulesByRuleKey(context);
@@ -57,7 +56,7 @@ public void sanity() {
}
@Test
- public void rulesLoaded() {
+ void rulesLoaded() {
profile.define(context);
Map activeRules = getActiveRulesByRuleKey(context);
diff --git a/src/test/java/com/vml/aemrules/htl/HtlSensorTest.java b/src/test/java/com/vml/aemrules/htl/HtlSensorTest.java
index f19a55d..611fb7e 100644
--- a/src/test/java/com/vml/aemrules/htl/HtlSensorTest.java
+++ b/src/test/java/com/vml/aemrules/htl/HtlSensorTest.java
@@ -21,8 +21,8 @@
import com.vml.aemrules.htl.checks.HtlAttributesShouldBeAtTheEndCheck;
import com.vml.aemrules.htl.rules.HtlRulesDefinition;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.sonar.api.SonarEdition;
import org.sonar.api.SonarQubeSide;
@@ -59,7 +59,7 @@
import static org.mockito.Mockito.when;
-public class HtlSensorTest {
+class HtlSensorTest {
private static final File TEST_DIR = new File("src/test/resources/sensor");
@@ -67,8 +67,8 @@ public class HtlSensorTest {
private SensorContextTester tester;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(8, 9), SonarQubeSide.SERVER, SonarEdition.COMMUNITY);
RulesDefinition rulesDefinition = new HtlRulesDefinition(sonarRuntime);
RulesDefinition.Context context = new RulesDefinition.Context();
@@ -105,7 +105,7 @@ private FileLinesContextFactory getMockedFileLinesContextFactory() {
}
@Test
- public void checkIncorrectFile_issuesFound() throws Exception {
+ void checkIncorrectFile_issuesFound() throws Exception {
DefaultInputFile inputFile = createInputFile(TEST_DIR, "test.html");
tester.fileSystem().add(inputFile);
sensor.execute(tester);
@@ -119,7 +119,7 @@ public void checkIncorrectFile_issuesFound() throws Exception {
}
@Test
- public void checkCancellation_noIssueFound() throws Exception {
+ void checkCancellation_noIssueFound() throws Exception {
DefaultInputFile inputFile = createInputFile(TEST_DIR, "test.html");
tester.fileSystem().add(inputFile);
tester.setCancelled(true);
@@ -128,7 +128,7 @@ public void checkCancellation_noIssueFound() throws Exception {
}
@Test
- public void sonarlintCheck() throws Exception {
+ void sonarlintCheck() throws Exception {
DefaultInputFile inputFile = createInputFile(TEST_DIR, "test.html");
tester.fileSystem().add(inputFile);
sensor.execute(tester);
@@ -139,7 +139,7 @@ public void sonarlintCheck() throws Exception {
}
@Test
- public void checkFileWithError_analysisErrorFound() throws Exception {
+ void checkFileWithError_analysisErrorFound() throws Exception {
DefaultInputFile inputFile = createInputFile(TEST_DIR, "error.html");
tester.fileSystem().add(inputFile);
sensor.execute(tester);
@@ -147,7 +147,7 @@ public void checkFileWithError_analysisErrorFound() throws Exception {
}
@Test
- public void checkExpressionWithinHtmlComment_noErrorsFound() throws Exception {
+ void checkExpressionWithinHtmlComment_noErrorsFound() throws Exception {
DefaultInputFile inputFile = createInputFile(TEST_DIR, "comment.html");
tester.fileSystem().add(inputFile);
sensor.execute(tester);
@@ -155,7 +155,7 @@ public void checkExpressionWithinHtmlComment_noErrorsFound() throws Exception {
}
@Test
- public void checkNestedTags_noErrorsFound() throws IOException {
+ void checkNestedTags_noErrorsFound() throws IOException {
DefaultInputFile inputFile = createInputFile(TEST_DIR, "nestedTags.html");
tester.fileSystem().add(inputFile);
sensor.execute(tester);
@@ -163,7 +163,7 @@ public void checkNestedTags_noErrorsFound() throws IOException {
}
@Test
- public void checkDescriptorConfiguration() {
+ void checkDescriptorConfiguration() {
DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
sensor.describe(descriptor);
assertThat(descriptor.name()).isEqualTo("HTL");
diff --git a/src/test/java/com/vml/aemrules/htl/HtlTest.java b/src/test/java/com/vml/aemrules/htl/HtlTest.java
index d56b6ae..abb4c0a 100644
--- a/src/test/java/com/vml/aemrules/htl/HtlTest.java
+++ b/src/test/java/com/vml/aemrules/htl/HtlTest.java
@@ -19,15 +19,15 @@
*/
package com.vml.aemrules.htl;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
-public class HtlTest {
+class HtlTest {
@Test
- public void shouldReturnEmptyArrayOfDefaultFileSuffixes() {
+ void shouldReturnEmptyArrayOfDefaultFileSuffixes() {
Htl htl = new Htl();
assertThat(htl.getFileSuffixes()).isEmpty();
}
diff --git a/src/test/java/com/vml/aemrules/htl/HtmlCheckVerifierTest.java b/src/test/java/com/vml/aemrules/htl/HtmlCheckVerifierTest.java
index bacd6ee..5bc759b 100644
--- a/src/test/java/com/vml/aemrules/htl/HtmlCheckVerifierTest.java
+++ b/src/test/java/com/vml/aemrules/htl/HtmlCheckVerifierTest.java
@@ -19,43 +19,47 @@
*/
package com.vml.aemrules.htl;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.sonar.api.rule.RuleKey;
import org.sonar.plugins.html.checks.HtmlIssue;
import java.util.ArrayList;
import java.util.List;
-public class HtmlCheckVerifierTest {
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class HtmlCheckVerifierTest {
private final HtmlCheckVerifier htmlCheckVerifier = new HtmlCheckVerifier();
- @Before
+ @BeforeEach
public void setUp() {
htmlCheckVerifier.collectExpectedIssues(HtmlCheckVerifier.ISSUE_MARKER, 1);
}
- @Test(expected = AssertionError.class)
- public void checkUnexpectedError() {
+ @Test
+ void checkUnexpectedError() {
List htmlIssues = new ArrayList<>();
htmlIssues.add(createLineIssue(1));
htmlIssues.add(createLineIssue(2));
- htmlCheckVerifier.checkIssues(htmlIssues);
+ assertThrows(AssertionError.class, () -> {
+ htmlCheckVerifier.checkIssues(htmlIssues);
+ });
}
- @Test()
- public void checkMultipleExpectedIssuesInTheSameLine() {
+ @Test
+ void checkMultipleExpectedIssuesInTheSameLine() {
List htmlIssues = new ArrayList<>();
htmlIssues.add(createLineIssue(1));
htmlIssues.add(createLineIssue(1));
htmlCheckVerifier.checkIssues(htmlIssues);
}
- @Test(expected = AssertionError.class)
- public void checkExpectedIssueButNotReported() {
+ @Test
+ void checkExpectedIssueButNotReported() {
List htmlIssues = new ArrayList<>();
- htmlCheckVerifier.checkIssues(htmlIssues);
+ assertThrows(AssertionError.class, () -> htmlCheckVerifier.checkIssues(htmlIssues));
}
private HtmlIssue createLineIssue(Integer line) {
diff --git a/src/test/java/com/vml/aemrules/htl/checks/AbstractHtlCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/AbstractHtlCheckTest.java
index 7ddf92d..c24562f 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/AbstractHtlCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/AbstractHtlCheckTest.java
@@ -19,11 +19,10 @@
*/
package com.vml.aemrules.htl.checks;
-
import com.vml.aemrules.htl.AbstractBaseTest;
import com.vml.aemrules.htl.Htl;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.plugins.html.checks.HtmlIssue;
@@ -34,14 +33,13 @@
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
-public class AbstractHtlCheckTest extends AbstractBaseTest {
- private AbstractHtlCheck check;
+class AbstractHtlCheckTest extends AbstractBaseTest {
- private HtmlSourceCode htmlSourceCode;
+ private AbstractHtlCheck check;
private static HtmlSourceCode createHtmlSourceCode(File file) {
return new HtmlSourceCode(
@@ -54,17 +52,17 @@ private static HtmlSourceCode createHtmlSourceCode(File file) {
);
}
- @Before
+ @BeforeEach
public void setUp() {
this.check = new AbstractHtlCheck();
File file = new File("src/test/files/htl/Empty.html");
- this.htmlSourceCode = createHtmlSourceCode(file);
- check.setSourceCode(htmlSourceCode);
+ HtmlSourceCode htmlSourceCode = createHtmlSourceCode(file);
+ this.check.setSourceCode(htmlSourceCode);
}
@Test
- public void creatingViolationWithoutCost() {
- check.createViolation(0, "Issue 0");
+ void creatingViolationWithoutCost() {
+ this.check.createViolation(0, "Issue 0");
List issues = check.getHtmlSourceCode().getIssues();
assertThat(issues).hasSize(1);
@@ -72,8 +70,8 @@ public void creatingViolationWithoutCost() {
}
@Test
- public void creatingViolationWithCost() {
- check.createViolation(1, "Issue 0", 1d);
+ void creatingViolationWithCost() {
+ this.check.createViolation(1, "Issue 0", 1d);
List issues = check.getHtmlSourceCode().getIssues();
assertThat(issues).hasSize(1);
@@ -81,9 +79,9 @@ public void creatingViolationWithCost() {
}
@Test
- public void creatingViolations() {
- check.createViolation(0, "Issue 0", 1d);
- check.createViolation(1, "Issue 1");
+ void creatingViolations() {
+ this.check.createViolation(0, "Issue 0", 1d);
+ this.check.createViolation(1, "Issue 1");
List issues = check.getHtmlSourceCode().getIssues();
assertThat(issues).hasSize(2);
diff --git a/src/test/java/com/vml/aemrules/htl/checks/AvoidExtraSlyTagsCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/AvoidExtraSlyTagsCheckTest.java
index 6203ba1..f4dbb6a 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/AvoidExtraSlyTagsCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/AvoidExtraSlyTagsCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class AvoidExtraSlyTagsCheckTest extends AbstractBaseTest {
+class AvoidExtraSlyTagsCheckTest extends AbstractBaseTest {
@Test
- public void avoidExtraSlyTags() {
- check = new AvoidExtraSlyTagsCheck();
- filename = "src/test/files/htl/AvoidExtraSlyTagsCheck.html";
+ void avoidExtraSlyTags() {
+ this.check = new AvoidExtraSlyTagsCheck();
+ this.filename = "src/test/files/htl/AvoidExtraSlyTagsCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/AvoidUsingUnsafeDisplayContextCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/AvoidUsingUnsafeDisplayContextCheckTest.java
index 0b98ab3..1940e8a 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/AvoidUsingUnsafeDisplayContextCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/AvoidUsingUnsafeDisplayContextCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class AvoidUsingUnsafeDisplayContextCheckTest extends AbstractBaseTest {
+class AvoidUsingUnsafeDisplayContextCheckTest extends AbstractBaseTest {
@Test
- public void checkAllDataAttributesContainsDisplayContext() {
- check = new AvoidUsingUnsafeDisplayContextCheck();
- filename = "src/test/files/htl/AvoidUsingUnsafeDisplayContextCheck.html";
+ void checkAllDataAttributesContainsDisplayContext() {
+ this.check = new AvoidUsingUnsafeDisplayContextCheck();
+ this.filename = "src/test/files/htl/AvoidUsingUnsafeDisplayContextCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/CamelCaseCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/CamelCaseCheckTest.java
index fdc2680..9b78d15 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/CamelCaseCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/CamelCaseCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class CamelCaseCheckTest extends AbstractBaseTest {
+class CamelCaseCheckTest extends AbstractBaseTest {
@Test
- public void checkCapitalization() {
- check = new CamelCaseCheck();
- filename = "src/test/files/htl/CamelCaseCheck.html";
+ void checkCapitalization() {
+ this.check = new CamelCaseCheck();
+ this.filename = "src/test/files/htl/CamelCaseCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/DefaultDisplayContextCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/DefaultDisplayContextCheckTest.java
index 68e305b..9fb6b39 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/DefaultDisplayContextCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/DefaultDisplayContextCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class DefaultDisplayContextCheckTest extends AbstractBaseTest {
+class DefaultDisplayContextCheckTest extends AbstractBaseTest {
@Test
- public void checkDefaultDisplayContext() {
- check = new DefaultDisplayContextCheck();
- filename = "src/test/files/htl/UseDefaultDisplayContextCheck.html";
+ void checkDefaultDisplayContext() {
+ this.check = new DefaultDisplayContextCheck();
+ this.filename = "src/test/files/htl/UseDefaultDisplayContextCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/DisplayContextInConditionalCommentsCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/DisplayContextInConditionalCommentsCheckTest.java
index 60e65ad..fe0f9af 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/DisplayContextInConditionalCommentsCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/DisplayContextInConditionalCommentsCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class DisplayContextInConditionalCommentsCheckTest extends AbstractBaseTest {
+class DisplayContextInConditionalCommentsCheckTest extends AbstractBaseTest {
@Test
- public void checkContextInConditionalComments() {
- check = new DisplayContextInConditionalCommentsCheck();
- filename = "src/test/files/htl/DisplayContextInConditionalCommentsCheck.html";
+ void checkContextInConditionalComments() {
+ this.check = new DisplayContextInConditionalCommentsCheck();
+ this.filename = "src/test/files/htl/DisplayContextInConditionalCommentsCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryForInlineStylesCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryForInlineStylesCheckTest.java
index 91f21c2..83cfe61 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryForInlineStylesCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryForInlineStylesCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class DisplayContextIsMandatoryForInlineStylesCheckTest extends AbstractBaseTest {
+class DisplayContextIsMandatoryForInlineStylesCheckTest extends AbstractBaseTest {
@Test
- public void checkInlineStyleDisplayContext() {
- check = new InlineStyleMandatoryDisplayContextCheck();
- filename = "src/test/files/htl/DefineDisplayContextInInlineStylesCheck.html";
+ void checkInlineStyleDisplayContext() {
+ this.check = new InlineStyleMandatoryDisplayContextCheck();
+ this.filename = "src/test/files/htl/DefineDisplayContextInInlineStylesCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryInEventAttributesTest.java b/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryInEventAttributesTest.java
index 96abdb9..03a6364 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryInEventAttributesTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryInEventAttributesTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class DisplayContextIsMandatoryInEventAttributesTest extends AbstractBaseTest {
+class DisplayContextIsMandatoryInEventAttributesTest extends AbstractBaseTest {
@Test
- public void checkEventAttributeDisplayContext() {
- check = new EventMandatoryDisplayContextCheck();
- filename = "src/test/files/htl/DefineDisplayContextInEventAttributes.html";
+ void checkEventAttributeDisplayContext() {
+ this.check = new EventMandatoryDisplayContextCheck();
+ this.filename = "src/test/files/htl/DefineDisplayContextInEventAttributes.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryInScriptsAndStylesCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryInScriptsAndStylesCheckTest.java
index f066474..67e50c5 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryInScriptsAndStylesCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/DisplayContextIsMandatoryInScriptsAndStylesCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class DisplayContextIsMandatoryInScriptsAndStylesCheckTest extends AbstractBaseTest {
+class DisplayContextIsMandatoryInScriptsAndStylesCheckTest extends AbstractBaseTest {
@Test
- public void checkScriptsAndStyleDisplayContext() {
- check = new ScriptsAndStyleMandatoryDisplayContextCheck();
- filename = "src/test/files/htl/DefineDisplayContextInScriptsAndStylesCheck.html";
+ void checkScriptsAndStyleDisplayContext() {
+ this.check = new ScriptsAndStyleMandatoryDisplayContextCheck();
+ this.filename = "src/test/files/htl/DefineDisplayContextInScriptsAndStylesCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/ExplicitNamesInLoopsCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/ExplicitNamesInLoopsCheckTest.java
index 036e3c7..84dbb9d 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/ExplicitNamesInLoopsCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/ExplicitNamesInLoopsCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class ExplicitNamesInLoopsCheckTest extends AbstractBaseTest {
+class ExplicitNamesInLoopsCheckTest extends AbstractBaseTest {
@Test
- public void ExplicitNamesInLoopsCheck() {
- check = new ExplicitNamesInLoopsCheck();
- filename = "src/test/files/htl/ExplicitNamesInLoopsCheck.html";
+ void ExplicitNamesInLoopsCheck() {
+ this.check = new ExplicitNamesInLoopsCheck();
+ this.filename = "src/test/files/htl/ExplicitNamesInLoopsCheck.html";
verify();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/HtlAttributesShouldBeAtTheEndCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/HtlAttributesShouldBeAtTheEndCheckTest.java
index c9e7490..3a0cdc0 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/HtlAttributesShouldBeAtTheEndCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/HtlAttributesShouldBeAtTheEndCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class HtlAttributesShouldBeAtTheEndCheckTest extends AbstractBaseTest {
+class HtlAttributesShouldBeAtTheEndCheckTest extends AbstractBaseTest {
@Test
- public void checkHtlAttributesOrder() {
- check = new HtlAttributesShouldBeAtTheEndCheck();
- filename = "src/test/files/htl/HtlAttributesShouldBeAtTheEndCheck.html";
+ void checkHtlAttributesOrder() {
+ this.check = new HtlAttributesShouldBeAtTheEndCheck();
+ this.filename = "src/test/files/htl/HtlAttributesShouldBeAtTheEndCheck.html";
verify();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/HtlCommentsCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/HtlCommentsCheckTest.java
index 45aec7d..f05af07 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/HtlCommentsCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/HtlCommentsCheckTest.java
@@ -21,14 +21,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class HtlCommentsCheckTest extends AbstractBaseTest {
+class HtlCommentsCheckTest extends AbstractBaseTest {
@Test
- public void checkHTLStyleOfCommenting() {
- check = new HtlCommentsCheck();
- filename = "src/test/files/htl/HtlCommentsCheck.html";
+ void checkHTLStyleOfCommenting() {
+ this.check = new HtlCommentsCheck();
+ this.filename = "src/test/files/htl/HtlCommentsCheck.html";
verify();
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/NamingAndReusingConditionsCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/NamingAndReusingConditionsCheckTest.java
index 060ad93..339011d 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/NamingAndReusingConditionsCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/NamingAndReusingConditionsCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class NamingAndReusingConditionsCheckTest extends AbstractBaseTest {
+class NamingAndReusingConditionsCheckTest extends AbstractBaseTest {
@Test
- public void checkHtlAttributesOrder() {
- check = new NamingAndReusingConditionsCheck();
- filename = "src/test/files/htl/NamingAndReusingConditionsCheck.html";
+ void checkHtlAttributesOrder() {
+ this.check = new NamingAndReusingConditionsCheck();
+ this.filename = "src/test/files/htl/NamingAndReusingConditionsCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/PlaceTemplatesInSeparateFilesCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/PlaceTemplatesInSeparateFilesCheckTest.java
index 3ffa945..a76a96d 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/PlaceTemplatesInSeparateFilesCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/PlaceTemplatesInSeparateFilesCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class PlaceTemplatesInSeparateFilesCheckTest extends AbstractBaseTest {
+class PlaceTemplatesInSeparateFilesCheckTest extends AbstractBaseTest {
@Test
- public void checkHtlAttributesOrder() {
- check = new PlaceTemplatesInSeparateFilesCheck();
- filename = "src/test/files/htl/PlaceTemplatesInSeparateFilesCheck.html";
+ void checkHtlAttributesOrder() {
+ this.check = new PlaceTemplatesInSeparateFilesCheck();
+ this.filename = "src/test/files/htl/PlaceTemplatesInSeparateFilesCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/SlyElementsAreAutomaticallyUnwrappedCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/SlyElementsAreAutomaticallyUnwrappedCheckTest.java
index 3c4c0fd..397cd22 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/SlyElementsAreAutomaticallyUnwrappedCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/SlyElementsAreAutomaticallyUnwrappedCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class SlyElementsAreAutomaticallyUnwrappedCheckTest extends AbstractBaseTest {
+class SlyElementsAreAutomaticallyUnwrappedCheckTest extends AbstractBaseTest {
@Test
- public void checkRedundantUnwrapAttributes() {
- check = new SlyElementsAreAutomaticallyUnwrappedCheck();
- filename = "src/test/files/htl/SlyElementsAreAutomaticallyUnwrappedCheck.html";
+ void checkRedundantUnwrapAttributes() {
+ this.check = new SlyElementsAreAutomaticallyUnwrappedCheck();
+ this.filename = "src/test/files/htl/SlyElementsAreAutomaticallyUnwrappedCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/UseMostRestrictiveHtlContextCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/UseMostRestrictiveHtlContextCheckTest.java
index d071b38..c38fdc5 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/UseMostRestrictiveHtlContextCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/UseMostRestrictiveHtlContextCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class UseMostRestrictiveHtlContextCheckTest extends AbstractBaseTest {
+class UseMostRestrictiveHtlContextCheckTest extends AbstractBaseTest {
@Test
- public void checkAllDataAttributesContainsDisplayContext() {
- check = new UseMostRestrictiveHtlContextCheck();
- filename = "src/test/files/htl/UseMostRestrictiveHtlContextCheck.html";
+ void checkAllDataAttributesContainsDisplayContext() {
+ this.check = new UseMostRestrictiveHtlContextCheck();
+ this.filename = "src/test/files/htl/UseMostRestrictiveHtlContextCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/checks/UseSlyTagsOverRedundantMarkupCheckTest.java b/src/test/java/com/vml/aemrules/htl/checks/UseSlyTagsOverRedundantMarkupCheckTest.java
index 4160029..f52cdc7 100644
--- a/src/test/java/com/vml/aemrules/htl/checks/UseSlyTagsOverRedundantMarkupCheckTest.java
+++ b/src/test/java/com/vml/aemrules/htl/checks/UseSlyTagsOverRedundantMarkupCheckTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.htl.checks;
import com.vml.aemrules.htl.AbstractBaseTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class UseSlyTagsOverRedundantMarkupCheckTest extends AbstractBaseTest {
+class UseSlyTagsOverRedundantMarkupCheckTest extends AbstractBaseTest {
@Test
- public void checkRedundantSlyTags() {
- check = new UseSlyTagsOverRedundantMarkupCheck();
- filename = "src/test/files/htl/UseSlyTagsOverRedundantMarkupCheck.html";
+ void checkRedundantSlyTags() {
+ this.check = new UseSlyTagsOverRedundantMarkupCheck();
+ this.filename = "src/test/files/htl/UseSlyTagsOverRedundantMarkupCheck.html";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/htl/visitors/HtlScannerTest.java b/src/test/java/com/vml/aemrules/htl/visitors/HtlScannerTest.java
index 0004ed1..01f51df 100644
--- a/src/test/java/com/vml/aemrules/htl/visitors/HtlScannerTest.java
+++ b/src/test/java/com/vml/aemrules/htl/visitors/HtlScannerTest.java
@@ -24,8 +24,8 @@
import com.vml.aemrules.htl.lex.HtlLexer;
import com.vml.aemrules.utils.Throwables;
import org.apache.sling.scripting.sightly.compiler.expression.Expression;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.plugins.html.node.CommentNode;
import org.sonar.plugins.html.node.Node;
@@ -39,9 +39,9 @@
import java.nio.charset.StandardCharsets;
import java.util.List;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-public class HtlScannerTest {
+class HtlScannerTest {
private HtlNodeCounterVisitor counterVisitor;
@@ -49,7 +49,7 @@ public class HtlScannerTest {
private HtlLexer lexer;
- @Before
+ @BeforeEach
public void setUp() {
lexer = new HtlLexer();
htlScanner = new HtlScanner();
@@ -58,7 +58,7 @@ public void setUp() {
}
@Test
- public void checkVisitedNode() {
+ void checkVisitedNode() {
HtmlSourceCode htmlSourceCode = createHtmlSourceCode("scanner/testFile.html");
try (Reader reader = readFile("scanner/testFile.html")) {
List nodes = lexer.parse(reader);
diff --git a/src/test/java/com/vml/aemrules/java/checks/AdministrativeAccessUsageCheckTest.java b/src/test/java/com/vml/aemrules/java/checks/AdministrativeAccessUsageCheckTest.java
index afe066f..3d65f8d 100644
--- a/src/test/java/com/vml/aemrules/java/checks/AdministrativeAccessUsageCheckTest.java
+++ b/src/test/java/com/vml/aemrules/java/checks/AdministrativeAccessUsageCheckTest.java
@@ -19,14 +19,14 @@
*/
package com.vml.aemrules.java.checks;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class AdministrativeAccessUsageCheckTest extends AbstractBaseTest {
+class AdministrativeAccessUsageCheckTest extends AbstractBaseTest {
@Test
- public void administrativeAccessUsageCheck() {
- check = new AdministrativeAccessUsageCheck();
- filename = "src/test/files/java/AdministrativeAccessUsageCheck.java";
+ void administrativeAccessUsageCheck() {
+ this.check = new AdministrativeAccessUsageCheck();
+ this.filename = "src/test/files/java/AdministrativeAccessUsageCheck.java";
verify();
}
diff --git a/src/test/java/com/vml/aemrules/java/checks/AnnotationsConstantsCheckTest.java b/src/test/java/com/vml/aemrules/java/checks/AnnotationsConstantsCheckTest.java
index 8fed164..902f652 100644
--- a/src/test/java/com/vml/aemrules/java/checks/AnnotationsConstantsCheckTest.java
+++ b/src/test/java/com/vml/aemrules/java/checks/AnnotationsConstantsCheckTest.java
@@ -19,14 +19,14 @@
*/
package com.vml.aemrules.java.checks;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class AnnotationsConstantsCheckTest extends AbstractBaseTest {
+class AnnotationsConstantsCheckTest extends AbstractBaseTest {
@Test
- public void checkConstantsInAnnotations() {
- check = new AnnotationsConstantsCheck();
- filename = "src/test/files/java/AnnotationsConstantsCheck.java";
+ void checkConstantsInAnnotations() {
+ this.check = new AnnotationsConstantsCheck();
+ this.filename = "src/test/files/java/AnnotationsConstantsCheck.java";
verify(false);
}
diff --git a/src/test/java/com/vml/aemrules/java/checks/ConstantsCheckTest.java b/src/test/java/com/vml/aemrules/java/checks/ConstantsCheckTest.java
index 40537e0..c81b55f 100644
--- a/src/test/java/com/vml/aemrules/java/checks/ConstantsCheckTest.java
+++ b/src/test/java/com/vml/aemrules/java/checks/ConstantsCheckTest.java
@@ -19,14 +19,14 @@
*/
package com.vml.aemrules.java.checks;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class ConstantsCheckTest extends AbstractBaseTest {
+class ConstantsCheckTest extends AbstractBaseTest {
@Test
- public void checkConstants() {
- check = new ConstantsCheck();
- filename = "src/test/files/java/ConstantsCheck.java";
+ void checkConstants() {
+ this.check = new ConstantsCheck();
+ this.filename = "src/test/files/java/ConstantsCheck.java";
verify(false);
}
}
diff --git a/src/test/java/com/vml/aemrules/java/checks/ContentResourceShouldBeNullCheckedCheckTest.java b/src/test/java/com/vml/aemrules/java/checks/ContentResourceShouldBeNullCheckedCheckTest.java
index bead113..ff6cf96 100644
--- a/src/test/java/com/vml/aemrules/java/checks/ContentResourceShouldBeNullCheckedCheckTest.java
+++ b/src/test/java/com/vml/aemrules/java/checks/ContentResourceShouldBeNullCheckedCheckTest.java
@@ -19,14 +19,14 @@
*/
package com.vml.aemrules.java.checks;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class ContentResourceShouldBeNullCheckedCheckTest extends AbstractBaseTest {
+class ContentResourceShouldBeNullCheckedCheckTest extends AbstractBaseTest {
@Test
- public void checkIfContentResourceIsNotNull() {
- check = new ContentResourceShouldBeNullCheckedCheck();
- filename = "src/test/files/java/ContentResourceShouldBeNullCheckedCheck.java";
+ void checkIfContentResourceIsNotNull() {
+ this.check = new ContentResourceShouldBeNullCheckedCheck();
+ this.filename = "src/test/files/java/ContentResourceShouldBeNullCheckedCheck.java";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/java/checks/DefaultInjectionStrategyAnnotationCheckTest.java b/src/test/java/com/vml/aemrules/java/checks/DefaultInjectionStrategyAnnotationCheckTest.java
index 3046038..54ade81 100644
--- a/src/test/java/com/vml/aemrules/java/checks/DefaultInjectionStrategyAnnotationCheckTest.java
+++ b/src/test/java/com/vml/aemrules/java/checks/DefaultInjectionStrategyAnnotationCheckTest.java
@@ -20,21 +20,21 @@
package com.vml.aemrules.java.checks;
import com.vml.aemrules.java.checks.slingmodels.DefaultInjectionStrategyAnnotationCheck;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class DefaultInjectionStrategyAnnotationCheckTest extends AbstractBaseTest {
+class DefaultInjectionStrategyAnnotationCheckTest extends AbstractBaseTest {
@Test
- public void checkAnnotation() {
- check = new DefaultInjectionStrategyAnnotationCheck();
- filename = "src/test/files/java/DefaultInjectionStrategyAnnotationCheck.java";
+ void checkAnnotation() {
+ this.check = new DefaultInjectionStrategyAnnotationCheck();
+ this.filename = "src/test/files/java/DefaultInjectionStrategyAnnotationCheck.java";
verify();
}
@Test
- public void checkMultipleAdaptablesAnnotation() {
- check = new DefaultInjectionStrategyAnnotationCheck();
- filename = "src/test/files/java/DefaultInjectionStrategyAnnotationCheckMultipleAdaptables.java";
+ void checkMultipleAdaptablesAnnotation() {
+ this.check = new DefaultInjectionStrategyAnnotationCheck();
+ this.filename = "src/test/files/java/DefaultInjectionStrategyAnnotationCheckMultipleAdaptables.java";
verify();
}
diff --git a/src/test/java/com/vml/aemrules/java/checks/ModifiableValueMapUsageCheckTest.java b/src/test/java/com/vml/aemrules/java/checks/ModifiableValueMapUsageCheckTest.java
index 8a98faa..86bd53f 100644
--- a/src/test/java/com/vml/aemrules/java/checks/ModifiableValueMapUsageCheckTest.java
+++ b/src/test/java/com/vml/aemrules/java/checks/ModifiableValueMapUsageCheckTest.java
@@ -19,14 +19,14 @@
*/
package com.vml.aemrules.java.checks;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class ModifiableValueMapUsageCheckTest extends AbstractBaseTest {
+class ModifiableValueMapUsageCheckTest extends AbstractBaseTest {
@Test
- public void checkIfMVMIsUsedToRetrievePropertiesFromResource() {
- check = new ModifiableValueMapUsageCheck();
- filename = "src/test/files/java/ModifiableValueMapUsageCheck.java";
+ void checkIfMVMIsUsedToRetrievePropertiesFromResource() {
+ this.check = new ModifiableValueMapUsageCheck();
+ this.filename = "src/test/files/java/ModifiableValueMapUsageCheck.java";
verify();
}
}
diff --git a/src/test/java/com/vml/aemrules/java/checks/PreferSlingServletAnnotationTest.java b/src/test/java/com/vml/aemrules/java/checks/PreferSlingServletAnnotationTest.java
index d347eb0..7a29f58 100644
--- a/src/test/java/com/vml/aemrules/java/checks/PreferSlingServletAnnotationTest.java
+++ b/src/test/java/com/vml/aemrules/java/checks/PreferSlingServletAnnotationTest.java
@@ -19,35 +19,30 @@
*/
package com.vml.aemrules.java.checks;
-import org.junit.Test;
-public class PreferSlingServletAnnotationTest extends AbstractBaseTest {
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
- @Test
- public void checkLackOfAnnotation() {
- check = new PreferSlingServletAnnotation();
- filename = "src/test/files/java/SlingServletOne.java";
- verify();
- }
-
- @Test
- public void checkMixedAnnotations() {
- check = new PreferSlingServletAnnotation();
- filename = "src/test/files/java/SlingServletTwo.java";
- verify();
- }
+class PreferSlingServletAnnotationTest extends AbstractBaseTest {
- @Test
- public void checkRedundantProperties() {
- check = new PreferSlingServletAnnotation();
- filename = "src/test/files/java/SlingServletThree.java";
+ @ParameterizedTest
+ @CsvSource({
+ "checkLackOfAnnotation,src/test/files/java/SlingServletOne.java",
+ "checkMixedAnnotations,src/test/files/java/SlingServletTwo.java",
+ "checkRedundantProperties,src/test/files/java/SlingServletThree.java"
+ })
+ void detect(String description, String fileName) {
+ System.out.println(description);
+ this.check = new PreferSlingServletAnnotation();
+ this.filename = fileName;
verify();
}
@Test
- public void checkStandardAnnotations() {
- check = new PreferSlingServletAnnotation();
- filename = "src/test/files/java/SlingServletWithStandardAnnotations.java";
+ void checkStandardAnnotations() {
+ this.check = new PreferSlingServletAnnotation();
+ this.filename = "src/test/files/java/SlingServletWithStandardAnnotations.java";
verifyNoIssues();
}
}
diff --git a/src/test/java/com/vml/aemrules/java/checks/ResourceResolverShouldBeClosedTest.java b/src/test/java/com/vml/aemrules/java/checks/ResourceResolverShouldBeClosedTest.java
index 5cc5ca7..ae96496 100644
--- a/src/test/java/com/vml/aemrules/java/checks/ResourceResolverShouldBeClosedTest.java
+++ b/src/test/java/com/vml/aemrules/java/checks/ResourceResolverShouldBeClosedTest.java
@@ -20,43 +20,34 @@
package com.vml.aemrules.java.checks;
import com.vml.aemrules.java.checks.resourceresolver.close.ResourceResolverShouldBeClosed;
-import org.junit.Test;
-
-public class ResourceResolverShouldBeClosedTest extends AbstractBaseTest {
-
- @Test
- public void checkInjectorNotClosedInFinallyBlock() {
- check = new ResourceResolverShouldBeClosed();
- filename = "src/test/files/java/SampleServlet.java";
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+class ResourceResolverShouldBeClosedTest extends AbstractBaseTest {
+
+ @ParameterizedTest
+ @CsvSource({
+ "checkInjectorNotClosedInFinallyBlock,src/test/files/java/SampleServlet.java",
+ "checkResourceResolverClosedInDeactivateMethodError,src/test/files/java/LongResourceResolverEvenListenerError.java"
+ })
+ void detect_1(String description, String fileName) {
+ System.out.println(description);
+ this.check = new ResourceResolverShouldBeClosed();
+ this.filename = fileName;
verify();
}
- @Test
- public void checkResourceResolverNotClosedInFinallyBlockWhenResourceResolverComesFromDifferentClass() {
- check = new ResourceResolverShouldBeClosed();
- filename = "src/test/files/java/ResourceResolverConsumer.java";
- verifyNoIssues();
- }
-
- @Test
- public void checkResourceResolverNotClosedWhenItIsOpenedInActivateAndClosedInDeactivate() {
- check = new ResourceResolverShouldBeClosed();
- filename = "src/test/files/java/LongSessionService.java";
+ @ParameterizedTest
+ @CsvSource({
+ "checkResourceResolverNotClosedInFinallyBlockWhenResourceResolverComesFromDifferentClass,src/test/files/java/ResourceResolverConsumer.java",
+ "checkResourceResolverNotClosedWhenItIsOpenedInActivateAndClosedInDeactivate,src/test/files/java/LongSessionService.java",
+ "checkResourceResolverClosedInDeactivateMethod,src/test/files/java/LongSessionEventListener.java"
+ })
+ void detect_2(String description, String fileName) {
+ System.out.println(description);
+ this.check = new ResourceResolverShouldBeClosed();
+ this.filename = fileName;
verifyNoIssues();
}
- @Test
- public void checkResourceResolverClosedInDeactivateMethod() {
- check = new ResourceResolverShouldBeClosed();
- filename = "src/test/files/java/LongSessionEventListener.java";
- verifyNoIssues();
- }
-
- @Test
- public void checkResourceResolverClosedInDeactivateMethodError() {
- check = new ResourceResolverShouldBeClosed();
- filename = "src/test/files/java/LongResourceResolverEvenListenerError.java";
- verify();
- }
-
}
diff --git a/src/test/java/com/vml/aemrules/java/checks/ResourceResolverTryWithResourcesTest.java b/src/test/java/com/vml/aemrules/java/checks/ResourceResolverTryWithResourcesTest.java
index 35ebc11..b02d784 100644
--- a/src/test/java/com/vml/aemrules/java/checks/ResourceResolverTryWithResourcesTest.java
+++ b/src/test/java/com/vml/aemrules/java/checks/ResourceResolverTryWithResourcesTest.java
@@ -20,14 +20,14 @@
package com.vml.aemrules.java.checks;
import com.vml.aemrules.java.checks.resourceresolver.close.ResourceResolverTryWithResourcesCheck;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class ResourceResolverTryWithResourcesTest extends AbstractBaseTest {
+class ResourceResolverTryWithResourcesTest extends AbstractBaseTest {
@Test
- public void checkResourceResolverUsesTryWithResourcesBlock() {
- check = new ResourceResolverTryWithResourcesCheck();
- filename = "src/test/files/java/AutoclosableResourceResolver.java";
+ void checkResourceResolverUsesTryWithResourcesBlock() {
+ this.check = new ResourceResolverTryWithResourcesCheck();
+ this.filename = "src/test/files/java/AutoclosableResourceResolver.java";
verify();
}
diff --git a/src/test/java/com/vml/aemrules/java/checks/SessionShouldBeLoggedOutTest.java b/src/test/java/com/vml/aemrules/java/checks/SessionShouldBeLoggedOutTest.java
index 6a89a90..79ce8d6 100644
--- a/src/test/java/com/vml/aemrules/java/checks/SessionShouldBeLoggedOutTest.java
+++ b/src/test/java/com/vml/aemrules/java/checks/SessionShouldBeLoggedOutTest.java
@@ -19,48 +19,31 @@
*/
package com.vml.aemrules.java.checks;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-@RunWith(Parameterized.class)
-public class SessionShouldBeLoggedOutTest extends AbstractBaseTest {
-
- private final boolean expectFailure;
-
- public SessionShouldBeLoggedOutTest(Object fn, Object expectFailure) {
- filename = (String) fn;
- this.expectFailure = ((Boolean) expectFailure).booleanValue();
- }
-
- // format is filename, failure expected
- @Parameterized.Parameters
- public static Collection