From b90b230414c0c1b7048592d1df91e5cbf66796b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Str=C3=A4hle?= Date: Sun, 12 May 2024 20:47:08 +0200 Subject: [PATCH] Try to fix tests --- .../generator/maven/plugin/ClasspathTypeTest.java | 3 +++ .../maven/plugin/CrdGeneratorMojoTest.java | 13 +++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/crd-generator/maven-plugin/src/test/java/io/fabric8/crd/generator/maven/plugin/ClasspathTypeTest.java b/crd-generator/maven-plugin/src/test/java/io/fabric8/crd/generator/maven/plugin/ClasspathTypeTest.java index 2101454f361..3e7b7ac89e2 100644 --- a/crd-generator/maven-plugin/src/test/java/io/fabric8/crd/generator/maven/plugin/ClasspathTypeTest.java +++ b/crd-generator/maven-plugin/src/test/java/io/fabric8/crd/generator/maven/plugin/ClasspathTypeTest.java @@ -20,6 +20,8 @@ import org.apache.maven.project.MavenProject; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledForJreRange; +import org.junit.jupiter.api.condition.JRE; import org.mockito.Mockito; import java.util.Collections; @@ -29,6 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.when; +@EnabledForJreRange(min = JRE.JAVA_17) class ClasspathTypeTest { private static final String RUNTIME_PATH = "/runtime"; diff --git a/crd-generator/maven-plugin/src/test/java/io/fabric8/crd/generator/maven/plugin/CrdGeneratorMojoTest.java b/crd-generator/maven-plugin/src/test/java/io/fabric8/crd/generator/maven/plugin/CrdGeneratorMojoTest.java index 6ca16ec9d4e..8f846ce91c0 100644 --- a/crd-generator/maven-plugin/src/test/java/io/fabric8/crd/generator/maven/plugin/CrdGeneratorMojoTest.java +++ b/crd-generator/maven-plugin/src/test/java/io/fabric8/crd/generator/maven/plugin/CrdGeneratorMojoTest.java @@ -18,15 +18,15 @@ import io.fabric8.crd.generator.collector.CustomResourceCollector; import io.fabric8.crdv2.generator.CRDGenerationInfo; import io.fabric8.crdv2.generator.CRDGenerator; -import io.fabric8.kubernetes.api.model.HasMetadata; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledForJreRange; +import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.api.io.TempDir; import org.mockito.ArgumentCaptor; -import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import java.io.File; @@ -40,12 +40,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyCollection; import static org.mockito.Mockito.when; +@EnabledForJreRange(min = JRE.JAVA_17) class CrdGeneratorMojoTest { CrdGeneratorMojo crdGeneratorMojo; - MavenProject mavenProject; CustomResourceCollector customResourceCollector; CRDGenerator crdGenerator; CRDGenerationInfo crdGenerationInfo; @@ -56,8 +57,8 @@ class CrdGeneratorMojoTest { void setup(@TempDir File tempDir) { customResourceCollector = Mockito.mock(CustomResourceCollector.class); when(customResourceCollector.withParentClassLoader(any())).thenReturn(customResourceCollector); - when(customResourceCollector.withClasspathElements(any())).thenReturn(customResourceCollector); - when(customResourceCollector.withFilesToScan(any())).thenReturn(customResourceCollector); + when(customResourceCollector.withClasspathElements(anyCollection())).thenReturn(customResourceCollector); + when(customResourceCollector.withFilesToScan(anyCollection())).thenReturn(customResourceCollector); when(customResourceCollector.withForceIndex(anyBoolean())).thenReturn(customResourceCollector); when(customResourceCollector.withForceScan(anyBoolean())).thenReturn(customResourceCollector); when(customResourceCollector.withCustomResourceClasses(any())).thenReturn(customResourceCollector); @@ -68,7 +69,7 @@ void setup(@TempDir File tempDir) { when(crdGenerator.inOutputDir(any())).thenReturn(crdGenerator); when(crdGenerator.withParallelGenerationEnabled(anyBoolean())).thenReturn(crdGenerator); when(crdGenerator.withImplicitPreserveUnknownFields(anyBoolean())).thenReturn(crdGenerator); - when(crdGenerator.customResourceClasses(ArgumentMatchers.> any())).thenReturn(crdGenerator); + when(crdGenerator.customResourceClasses(any())).thenReturn(crdGenerator); crdGenerationInfo = Mockito.mock(CRDGenerationInfo.class); when(crdGenerator.detailedGenerate()).thenReturn(crdGenerationInfo);