Skip to content
Closed
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 @@ -29,21 +29,21 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class Embedded3xLauncherTest {
class Embedded3xLauncherTest {
@TempDir
private Path temporaryDir;

private final String workingDir =
Paths.get("src/test/resources").toAbsolutePath().toString();

@Test
public void testWithClasspath() throws Exception {
void withClasspath() throws Exception {
MavenLauncher launcher = Embedded3xLauncher.createFromClasspath();
runLauncher(launcher);
}

@Test
public void testWithMavenHome() throws Exception {
void withMavenHome() throws Exception {
MavenLauncher launcher = Embedded3xLauncher.createFromMavenHome(System.getProperty("maven.home"), null, null);
runLauncher(launcher);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.fail;

public class ForkedLauncherTest {
class ForkedLauncherTest {
@TempDir
private Path temporaryDir;

Expand All @@ -46,7 +46,7 @@ public class ForkedLauncherTest {
Paths.get("src/test/resources/wrapper-project").toAbsolutePath().toString();

@Test
public void mvnw() throws Exception {
void mvnw() throws Exception {
launcher = new ForkedLauncher(".", Collections.emptyMap(), false, true);
Path logFile = temporaryDir.resolve("build.log");

Expand All @@ -59,7 +59,7 @@ public void mvnw() throws Exception {
}

@Test
public void mvnwDebug() throws Exception {
void mvnwDebug() throws Exception {
launcher = new ForkedLauncher(".", Collections.emptyMap(), true, true);
Path logFile = temporaryDir.resolve("build.log");

Expand Down
29 changes: 14 additions & 15 deletions src/test/java/org/apache/maven/shared/verifier/VerifierTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import java.util.stream.Stream;

import org.apache.commons.io.FileUtils;
import org.apache.maven.settings.building.SettingsBuildingException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
Expand Down Expand Up @@ -78,7 +77,7 @@ private void check(String expected, String... lines) {
}

@Test
public void testSunBug9009028ForJdk() {
void sunBug9009028ForJdk() {
Properties oldProperties = System.getProperties();
try {
final String version = System.getProperty("java.version");
Expand All @@ -90,7 +89,7 @@ public void testSunBug9009028ForJdk() {
}

@Test
public void testExtractMavenVersion() {
void extractMavenVersion() {
check("2.0.6", "Maven version: 2.0.6");

check(
Expand Down Expand Up @@ -119,7 +118,7 @@ public void testExtractMavenVersion() {
}

@Test
public void testFileInJarPresent() throws VerificationException {
void fileInJarPresent() throws Exception {
// File file = new File( "src/test/resources/mshared104.jar!fud.xml" );
Verifier verifier = new Verifier("src/test/resources");
verifier.verifyFilePresent("mshared104.jar!/pom.xml");
Expand All @@ -128,17 +127,17 @@ public void testFileInJarPresent() throws VerificationException {
}

@Test
public void testStripAnsi() {
void stripAnsi() {
assertEquals(
"--- plugin:version:goal (id) @ artifactId ---",
Verifier.stripAnsi("\u001B[1m--- \u001B[0;32mplugin:version:goal\u001B[0;1m (id)\u001B[m @ "
+ "\u001B[36martifactId\u001B[0;1m ---\u001B[m"));
}

@Test
public void testLoadPropertiesFNFE() {
void loadPropertiesFNFE() {
Verifier verifier = new Verifier("src/test/resources");
VerificationException exception = assertThrows(VerificationException.class, () -> {
Verifier verifier = new Verifier("src/test/resources");
try {
verifier.loadProperties("unknown.properties");
} finally {
Expand All @@ -149,7 +148,7 @@ public void testLoadPropertiesFNFE() {
}

@Test
public void testDedicatedMavenHome() throws VerificationException, IOException {
void dedicatedMavenHome() throws Exception {
String mavenHome =
Paths.get("src/test/resources/maven-home").toAbsolutePath().toString();
Verifier verifier = new Verifier(temporaryDir.toString(), null, false, mavenHome);
Expand All @@ -160,7 +159,7 @@ public void testDedicatedMavenHome() throws VerificationException, IOException {
}

@Test
void testDefaultFilterMap() throws VerificationException {
void defaultFilterMap() throws Exception {
Verifier verifier = new Verifier("src/test/resources");
Map<String, String> filterMap = verifier.newDefaultFilterMap();
verifier.resetStreams();
Expand All @@ -171,7 +170,7 @@ void testDefaultFilterMap() throws VerificationException {
}

@Test
void testDefaultMavenArgument() throws VerificationException {
void defaultMavenArgument() throws Exception {
TestVerifier verifier = new TestVerifier("src/test/resources");

verifier.executeGoal("test");
Expand All @@ -188,7 +187,7 @@ void testDefaultMavenArgument() throws VerificationException {
}

@Test
void testDefaultMavenArgumentWithExecuteMethod() throws VerificationException {
void defaultMavenArgumentWithExecuteMethod() throws Exception {
TestVerifier verifier = new TestVerifier("src/test/resources");

verifier.addCliArgument("test");
Expand All @@ -214,7 +213,7 @@ public static Stream<Arguments> argumentsForTest() {

@ParameterizedTest
@MethodSource("argumentsForTest")
void argumentShouldBePassedAsIs(String inputArgument, String expectedArgument) throws VerificationException {
void argumentShouldBePassedAsIs(String inputArgument, String expectedArgument) throws Exception {
TestVerifier verifier = new TestVerifier("src/test/resources");

verifier.addCliArgument(inputArgument);
Expand All @@ -225,7 +224,7 @@ void argumentShouldBePassedAsIs(String inputArgument, String expectedArgument) t
}

@Test
void addCliArgsShouldAddSeparateArguments() throws VerificationException {
void addCliArgsShouldAddSeparateArguments() throws Exception {
TestVerifier verifier = new TestVerifier("src/test/resources");

verifier.addCliArguments("cliArg1", "cliArg2");
Expand All @@ -236,15 +235,15 @@ void addCliArgsShouldAddSeparateArguments() throws VerificationException {
}

@Test
void testInterpolationInSettingsFile() throws SettingsBuildingException {
void interpolationInSettingsFile() throws Exception {
// use settings.xml with expressions for local repo
String localRepo = Verifier.retrieveLocalRepo("src/test/resources/settings-with-expressions.xml");
String expectedLocalRepo = System.getProperty("user.home") + "/test-repository";
assertEquals(expectedLocalRepo, localRepo);
}

@Test
public void useRealLogFile() throws Exception {
void useRealLogFile() throws Exception {
FileUtils.copyDirectory(new File("src/test/resources"), new File("target/test-project"));
Verifier verifier = new Verifier(new File("target/test-project").getAbsolutePath());
verifier.setForkJvm(true);
Expand Down
Loading