Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@
package org.sonar.samples.java.checks;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.event.Level;
import org.sonar.api.testfixtures.log.LogTesterJUnit5;
import org.sonar.java.checks.verifier.CheckVerifier;

class AvoidBrandInMethodNamesRuleTest {

// Set a LogTester to see the Syntax Tree when running tests and executing the rule
@RegisterExtension
public LogTesterJUnit5 logTester = new LogTesterJUnit5().setLevel(Level.DEBUG);

@Test
void detected() {
// Verifies that the check will raise the adequate issues with the expected message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@
package org.sonar.samples.java.checks;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.event.Level;
import org.sonar.api.testfixtures.log.LogTesterJUnit5;
import org.sonar.java.checks.verifier.CheckVerifier;

class SecurityAnnotationMandatoryRuleTest {

// Set a LogTester to see the Syntax Tree when running tests and executing the rule
@RegisterExtension
public LogTesterJUnit5 logTester = new LogTesterJUnit5().setLevel(Level.DEBUG);

@Test
void detected() {
// Use an instance of the check under test to raise the issue.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
Expand All @@ -42,7 +41,7 @@

class CheckstyleSensorTest {

private static final Path PROJECT_DIR = Paths.get("src", "test", "resources", "checkstyle")
private static final Path PROJECT_DIR = Path.of("src", "test", "resources", "checkstyle")
.toAbsolutePath().normalize();

private static SensorContextTester sensorContext = SensorContextTester.create(PROJECT_DIR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
Expand All @@ -43,7 +42,7 @@

class SpotBugsSensorTest {

private static final Path PROJECT_DIR = Paths.get("src", "test", "resources", "spotbugs")
private static final Path PROJECT_DIR = Path.of("src", "test", "resources", "spotbugs")
.toAbsolutePath().normalize();

private static SensorContextTester sensorContext = SensorContextTester.create(PROJECT_DIR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
import static org.assertj.core.api.Assertions.assertThat;

class FilesUtilsTest {
@TempDir
public Path temp;

@Test
void verify_get_classpath_files() throws IOException {
void verify_get_classpath_files(@TempDir Path temp) throws IOException {
Path tmp = Files.createDirectory(temp.resolve("tmp"));
Path jar = tmp.resolve("test.jar");
Path zip = tmp.resolve("test.zip");
Expand Down