Skip to content

Commit

Permalink
fix: replace AssertJ's deprecated asList() DSL method in HelidonGener…
Browse files Browse the repository at this point in the history
…atorTest

Signed-off-by: arman-yekkehkhani <[email protected]>
  • Loading branch information
arman-yekkehkhani authored Jun 17, 2024
1 parent cf73bdc commit 1500dc4
Showing 1 changed file with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.eclipse.jkube.generator.api.GeneratorContext;
import org.eclipse.jkube.kit.common.Assembly;
import org.eclipse.jkube.kit.common.AssemblyConfiguration;
import org.eclipse.jkube.kit.common.AssemblyFileSet;
import org.eclipse.jkube.kit.common.Dependency;
import org.eclipse.jkube.kit.common.JavaProject;
import org.eclipse.jkube.kit.common.KitLogger;
Expand Down Expand Up @@ -193,7 +194,8 @@ void customize_withStandardPackaging_hasJolokiaPort(){
final List<ImageConfiguration> result = new HelidonGenerator(ctx).customize(new ArrayList<>(), true);
// Then
assertThat(result).singleElement()
.extracting("buildConfiguration.ports").asList()
.extracting("buildConfiguration.ports")
.asInstanceOf(InstanceOfAssertFactories.list(String.class))
.contains("8778");
}

Expand All @@ -218,7 +220,8 @@ void customize_withStandardPackaging_hasPrometheusPort(){
final List<ImageConfiguration> result = new HelidonGenerator(ctx).customize(new ArrayList<>(), true);
// Then
assertThat(result).singleElement()
.extracting("buildConfiguration.ports").asList()
.extracting("buildConfiguration.ports")
.asInstanceOf(InstanceOfAssertFactories.list(String.class))
.contains("9779");
}

Expand Down Expand Up @@ -256,20 +259,25 @@ void customize_inKubernetesAndJarArtifact_shouldCreateAssembly() throws IOExcept
.hasFieldOrPropertyWithValue("targetDir", "/deployments")
.hasFieldOrPropertyWithValue("excludeFinalOutputArtifact", true)
.extracting(AssemblyConfiguration::getLayers)
.asList().hasSize(2)
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class))
.hasSize(2)
.satisfies(layers -> assertThat(layers).first().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.hasFieldOrPropertyWithValue("id", "libs")
.extracting(Assembly::getFileSets)
.asList().singleElement()
.asInstanceOf(InstanceOfAssertFactories.list(AssemblyFileSet.class))
.singleElement()
.hasFieldOrPropertyWithValue("outputDirectory", new File("."))
.extracting("includes").asList()
.extracting("includes")
.asInstanceOf(InstanceOfAssertFactories.list(String.class))
.containsExactly("libs"))
.satisfies(layers -> assertThat(layers).element(1).asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.hasFieldOrPropertyWithValue("id", "artifact")
.extracting(Assembly::getFileSets)
.asList().singleElement()
.asInstanceOf(InstanceOfAssertFactories.list(AssemblyFileSet.class))
.singleElement()
.hasFieldOrPropertyWithValue("outputDirectory", new File("."))
.extracting("includes").asList()
.extracting("includes")
.asInstanceOf(InstanceOfAssertFactories.list(String.class))
.containsExactly("sample.jar"));
}

Expand All @@ -293,9 +301,10 @@ void customize_inKubernetesAndNativeArtifact_shouldCreateNativeAssembly() throws
.extracting(BuildConfiguration::getAssembly)
.hasFieldOrPropertyWithValue("targetDir", "/")
.extracting(AssemblyConfiguration::getLayers)
.asList().singleElement().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.asInstanceOf(InstanceOfAssertFactories.list(Assembly.class))
.singleElement().asInstanceOf(InstanceOfAssertFactories.type(Assembly.class))
.extracting(Assembly::getFileSets)
.asList()
.asInstanceOf(InstanceOfAssertFactories.list(AssemblyFileSet.class))
.hasSize(1)
.flatExtracting("includes")
.containsExactly("sample");
Expand Down

0 comments on commit 1500dc4

Please sign in to comment.