mockConfiguration = configurationDependencyMock();
projectConfigurations.add(mockConfiguration.apply(new String[] { "api", "com.example", "artifact", null }));
@@ -164,7 +164,7 @@ public void extractDependencies_withMultipleAndDuplicateDependencies_shouldRetur
}
@Test
- public void extractPlugins_withMultipleAndBuildScriptDuplicateDependencies_shouldReturnValidPlugins() {
+ void extractPlugins_withMultipleAndBuildScriptDuplicateDependencies_shouldReturnValidPlugins() {
// Given
final ConfigurationContainer cc = mock(ConfigurationContainer.class);
when(project.getBuildscript().getConfigurations()).thenReturn(cc);
@@ -196,7 +196,7 @@ public void extractPlugins_withMultipleAndBuildScriptDuplicateDependencies_shoul
* into an ArrayList.
*/
@Test
- public void convertGradleProject_withConcurrentConfigurationModifications_shouldReturnValidProject() {
+ void convertGradleProject_withConcurrentConfigurationModifications_shouldReturnValidProject() {
// Given
final Configuration mockConfiguration = mock(Configuration.class, RETURNS_DEEP_STUBS);
projectConfigurations.add(mockConfiguration);
@@ -216,18 +216,18 @@ public void convertGradleProject_withConcurrentConfigurationModifications_should
}
@Test
- public void findClassesOutputDirectory_withNotFoundSourceSet_shouldReturnDefault() {
+ void findClassesOutputDirectory_withNotFoundSourceSet_shouldReturnDefault() {
// Given
when(javaPlugin.getSourceSets().getByName("main")).thenThrow(new UnknownDomainObjectException("Not found"));
// When
final JavaProject result = convertGradleProject(project);
// Then
assertThat(result.getOutputDirectory())
- .isEqualTo(folder.getRoot().toPath().resolve("build").resolve("classes").resolve("java").resolve("main").toFile());
+ .isEqualTo(folder.resolve("build").resolve("classes").resolve("java").resolve("main").toFile());
}
@Test
- public void findClassesOutputDirectory_withValidSourceSet_shouldReturnFromSourceSet() {
+ void findClassesOutputDirectory_withValidSourceSet_shouldReturnFromSourceSet() {
// Given
when(javaPlugin.getSourceSets().getByName("main").getJava().getDestinationDirectory().getAsFile())
.thenReturn(new DefaultProvider<>(() -> new File("classes")));
@@ -238,23 +238,23 @@ public void findClassesOutputDirectory_withValidSourceSet_shouldReturnFromSource
}
@Test
- public void findClassesOutputDirectory_withNoSourceSets_shouldReturnDefault() {
+ void findClassesOutputDirectory_withNoSourceSets_shouldReturnDefault() {
// Given
when(javaPlugin.getSourceSets()).thenReturn(null);
// When
final JavaProject result = convertGradleProject(project);
// Then
assertThat(result.getOutputDirectory())
- .isEqualTo(folder.getRoot().toPath().resolve("build").resolve("classes").resolve("java").resolve("main").toFile());
+ .isEqualTo(folder.resolve("build").resolve("classes").resolve("java").resolve("main").toFile());
}
@Test
- public void findArtifact_withExistentFile_shouldReturnValidArtifact() throws IOException {
+ void findArtifact_withExistentFile_shouldReturnValidArtifact() throws IOException {
// Given
final Configuration c = mock(Configuration.class, RETURNS_DEEP_STUBS);
when(c.getAllDependencies().stream()).thenAnswer(i -> Stream.empty());
when(c.getOutgoing().getArtifacts().getFiles().getFiles()).thenReturn(Stream.of(
- folder.newFile("final-artifact.jar")
+ Files.createFile(folder.resolve("final-artifact.jar")).toFile()
).collect(Collectors.toSet()));
projectConfigurations.add(c);
// When
@@ -264,12 +264,12 @@ public void findArtifact_withExistentFile_shouldReturnValidArtifact() throws IOE
}
@Test
- public void findArtifact_withMultipleExistentFiles_shouldReturnArtifactWithLargestSize() throws IOException {
+ void findArtifact_withMultipleExistentFiles_shouldReturnArtifactWithLargestSize() throws IOException {
// Given
final Configuration c = mock(Configuration.class, RETURNS_DEEP_STUBS);
- File jar1 = folder.newFile("final-artifact.jar");
+ File jar1 = Files.createFile(folder.resolve("final-artifact.jar")).toFile();
Files.write(jar1.toPath(), "FatJar".getBytes());
- File jar2 = folder.newFile("final-artifact-plain.jar");
+ File jar2 = Files.createFile(folder.resolve("final-artifact-plain.jar")).toFile();
when(c.getAllDependencies().stream()).thenAnswer(i -> Stream.empty());
when(c.getOutgoing().getArtifacts().getFiles().getFiles()).thenReturn(Stream.of(
jar2, jar1
@@ -282,12 +282,12 @@ public void findArtifact_withMultipleExistentFiles_shouldReturnArtifactWithLarge
}
@Test
- public void findArtifact_withMultipleArchiveFiles_shouldReturnJavaArchiveOnly() throws IOException {
+ void findArtifact_withMultipleArchiveFiles_shouldReturnJavaArchiveOnly() throws IOException {
// Given
final Configuration c = mock(Configuration.class, RETURNS_DEEP_STUBS);
- File jar1 = folder.newFile("final-artifact.jar");
- File jar2 = folder.newFile("final-artifact.tar");
- File jar3 = folder.newFile("final-artifact.zip");
+ File jar1 = Files.createFile(folder.resolve("final-artifact.jar")).toFile();
+ File jar2 = Files.createFile(folder.resolve("final-artifact.tar")).toFile();
+ File jar3 = Files.createFile(folder.resolve("final-artifact.zip")).toFile();
when(c.getAllDependencies().stream()).thenAnswer(i -> Stream.empty());
when(c.getOutgoing().getArtifacts().getFiles().getFiles()).thenReturn(Stream.of(jar1, jar2, jar3).collect(Collectors.toSet()));
projectConfigurations.add(c);
@@ -298,7 +298,7 @@ public void findArtifact_withMultipleArchiveFiles_shouldReturnJavaArchiveOnly()
}
@Test
- public void canBeResolved_withDeprecatedAndResolutionAlternatives_shouldReturnFalse() {
+ void canBeResolved_withDeprecatedAndResolutionAlternatives_shouldReturnFalse() {
// Given
final DeprecatableConfiguration c = mock(DeprecatableConfiguration.class);
when(c.getResolutionAlternatives()).thenReturn(Collections.emptyList());
@@ -309,7 +309,7 @@ public void canBeResolved_withDeprecatedAndResolutionAlternatives_shouldReturnFa
}
@Test
- public void canBeResolved_DeprecatedAndNullResolutionAlternativesAndResolvable_shouldReturnTrue() {
+ void canBeResolved_DeprecatedAndNullResolutionAlternativesAndResolvable_shouldReturnTrue() {
// Given
final DeprecatableConfiguration c = mock(DeprecatableConfiguration.class);
when(c.isCanBeResolved()).thenReturn(true);
diff --git a/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/GroovyUtilTest.java b/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/GroovyUtilTest.java
index c2b6eea395..8367b561d4 100644
--- a/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/GroovyUtilTest.java
+++ b/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/GroovyUtilTest.java
@@ -22,15 +22,15 @@
import groovy.lang.Closure;
import org.codehaus.groovy.runtime.GStringImpl;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
import static org.eclipse.jkube.gradle.plugin.GroovyUtil.closureTo;
import static org.eclipse.jkube.gradle.plugin.GroovyUtil.invokeOrParseClosureList;
-@SuppressWarnings({ "unused", "serial" })
-public class GroovyUtilTest {
+@SuppressWarnings("unused")
+class GroovyUtilTest {
/**
*
@@ -45,7 +45,7 @@ public class GroovyUtilTest {
*
*/
@Test
- public void closureTo_withNestedClosure_shouldReturnStructuredClass() {
+ void closureTo_withNestedClosure_shouldReturnStructuredClass() {
// Given
final Closure> closure = closure(this,
"property", new GStringImpl(new Object[] { "lue" }, new String[] { "va" }),
@@ -67,7 +67,7 @@ public void closureTo_withNestedClosure_shouldReturnStructuredClass() {
*/
@SuppressWarnings("unchecked")
@Test
- public void closureTo_withNestedClosureCollection_shouldReturnMap() {
+ void closureTo_withNestedClosureCollection_shouldReturnMap() {
// Given
final Closure> closure = closure(this,
"array", Arrays.asList("one", "two", closure(this, "nested", "closure")));
@@ -95,7 +95,7 @@ public void closureTo_withNestedClosureCollection_shouldReturnMap() {
*
*/
@Test
- public void invokeOrParseClosureList_namedClosureListTo_withNamedListNestedClosure_shouldReturnOrderedList() {
+ void invokeOrParseClosureList_namedClosureListTo_withNamedListNestedClosure_shouldReturnOrderedList() {
// Given
final Closure> element1 = closure(this, "property", "value",
"nested", closure(this, "nestedProperty", "nestedValue"));
diff --git a/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/JKubePluginTest.java b/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/JKubePluginTest.java
index a12539292f..551eb9a1c5 100644
--- a/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/JKubePluginTest.java
+++ b/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/JKubePluginTest.java
@@ -17,16 +17,16 @@
import java.util.Map;
import org.gradle.api.Task;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-public class JKubePluginTest {
+class JKubePluginTest {
@Test
- public void getTaskPrecedence_withDefaults_shouldReturnEmpty() {
+ void getTaskPrecedence_withDefaults_shouldReturnEmpty() {
// Given
final JKubePlugin partial = mock(JKubePlugin.class);
when(partial.getTaskPrecedence()).thenCallRealMethod();
diff --git a/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/KubernetesExtensionPropertyTest.java b/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/KubernetesExtensionPropertyTest.java
index d3ff9c999f..f21b0a8393 100644
--- a/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/KubernetesExtensionPropertyTest.java
+++ b/gradle-plugin/kubernetes/src/test/java/org/eclipse/jkube/gradle/plugin/KubernetesExtensionPropertyTest.java
@@ -15,8 +15,7 @@
import java.io.File;
import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.Collection;
+import java.util.stream.Stream;
import org.eclipse.jkube.kit.build.service.docker.helper.ContainerNamingUtil;
import org.eclipse.jkube.kit.common.JavaProject;
@@ -24,144 +23,21 @@
import org.eclipse.jkube.kit.common.ResourceFileType;
import org.eclipse.jkube.kit.config.image.WatchMode;
import org.eclipse.jkube.kit.config.image.build.JKubeBuildStrategy;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.params.provider.Arguments.arguments;
-@RunWith(Parameterized.class)
-public class KubernetesExtensionPropertyTest {
-
- public static File BASE = new File("");
-
- @Parameterized.Parameters(name = "{index} {0}, returns {4}, or with property {1}={2} returns {3}")
- public static Collection