Skip to content

Commit

Permalink
fix: replace AssertJ's deprecated asList() DSL method in ContainerEnv…
Browse files Browse the repository at this point in the history
…JavaOptionsMergeVisitorTest (3379)
  • Loading branch information
vijaybhagwat24 authored Sep 11, 2024
1 parent e5817e5 commit 158b354
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

import java.util.Collections;


import io.fabric8.kubernetes.api.model.apps.Deployment;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.eclipse.jkube.kit.config.image.ImageConfiguration;

import io.fabric8.kubernetes.api.model.Container;
Expand Down Expand Up @@ -72,7 +75,7 @@ void imageConfigurationAndContainersWithMatchingImageNameAndNoEnvShouldDoNothing
kubernetesListBuilder.accept(new ContainerEnvJavaOptionsMergeEnricher
.ContainerEnvJavaOptionsMergeVisitor(Collections.singletonList(imageConfiguration)));
// Then
assertThat(kubernetesListBuilder.build().getItems()).asList()
assertThat(kubernetesListBuilder.build().getItems()).asInstanceOf(InstanceOfAssertFactories.list(Deployment.class))
.hasSize(1)
.flatExtracting("spec.template.spec.containers")
.flatExtracting("env").isEmpty();
Expand All @@ -91,7 +94,7 @@ void imageConfigurationWithJavaOptionsEnvAndContainersWithMatchingImageNameShoul
kubernetesListBuilder.accept(new ContainerEnvJavaOptionsMergeEnricher
.ContainerEnvJavaOptionsMergeVisitor(Collections.singletonList(imageConfiguration)));
// Then
assertThat(kubernetesListBuilder.build().getItems()).asList()
assertThat(kubernetesListBuilder.build().getItems()).asInstanceOf(InstanceOfAssertFactories.list(Deployment.class))
.hasSize(1)
.flatExtracting("spec.template.spec.containers")
.flatExtracting("env").isEmpty();
Expand All @@ -114,7 +117,7 @@ void imageConfigurationWithJavaOptionsEnvAndContainersWithMatchingImageNameAndEn
kubernetesListBuilder.accept(new ContainerEnvJavaOptionsMergeEnricher
.ContainerEnvJavaOptionsMergeVisitor(Collections.singletonList(imageConfiguration)));
// Then
assertThat(containerList(kubernetesListBuilder)).asList()
assertThat(containerList(kubernetesListBuilder)).asInstanceOf(InstanceOfAssertFactories.list(Container.class))
.hasSize(2)
.filteredOn("image", "the-image:latest")
.hasSize(1)
Expand All @@ -123,7 +126,7 @@ void imageConfigurationWithJavaOptionsEnvAndContainersWithMatchingImageNameAndEn
new EnvVar("JAVA_OPTIONS", "-DsomeOption -DotherOption", null),
new EnvVar("OTHER", "OTHER_VALUE", null)
);
assertThat(containerList(kubernetesListBuilder)).asList()
assertThat(containerList(kubernetesListBuilder)).asInstanceOf(InstanceOfAssertFactories.list(Container.class))
.filteredOn("image", "other-image:latest")
.hasSize(1)
.flatExtracting("env")
Expand Down

0 comments on commit 158b354

Please sign in to comment.