From beb975cb61a56d01804f29eb82798f2fbbbf251f Mon Sep 17 00:00:00 2001 From: Shivam <96533413+ShivamChavan01@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:50:20 +0530 Subject: [PATCH] fix: replace AssertJ's deprecated asList() DSL method in DockerHealthCheckEnricherTest (3466) --- .../specific/DockerHealthCheckEnricherTest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jkube-kit/enricher/specific/src/test/java/org/eclipse/jkube/kit/enricher/specific/DockerHealthCheckEnricherTest.java b/jkube-kit/enricher/specific/src/test/java/org/eclipse/jkube/kit/enricher/specific/DockerHealthCheckEnricherTest.java index 010a1042c3..00ff64e88c 100644 --- a/jkube-kit/enricher/specific/src/test/java/org/eclipse/jkube/kit/enricher/specific/DockerHealthCheckEnricherTest.java +++ b/jkube-kit/enricher/specific/src/test/java/org/eclipse/jkube/kit/enricher/specific/DockerHealthCheckEnricherTest.java @@ -17,10 +17,12 @@ import java.util.Collections; import java.util.List; +import io.fabric8.kubernetes.api.model.Container; import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.KubernetesList; import io.fabric8.kubernetes.api.model.KubernetesListBuilder; import io.fabric8.kubernetes.api.model.apps.DeploymentBuilder; +import org.assertj.core.api.InstanceOfAssertFactories; import org.eclipse.jkube.kit.config.image.build.BuildConfiguration; import org.eclipse.jkube.kit.config.image.ImageConfiguration; import org.eclipse.jkube.kit.common.Arguments; @@ -202,7 +204,7 @@ private KubernetesListBuilder addDeployment(KubernetesListBuilder list, String n private void assertNoProbes(KubernetesList list) { assertThat(list.getItems()).singleElement() .extracting("spec.template.spec.containers") - .asList() + .asInstanceOf(InstanceOfAssertFactories.list(Container.class)) .first() .hasFieldOrPropertyWithValue("livenessProbe", null) .hasFieldOrPropertyWithValue("readinessProbe", null); @@ -210,14 +212,16 @@ private void assertNoProbes(KubernetesList list) { private void assertHealthCheckMatching(HasMetadata resource, String type, String command, int timeoutSeconds, int periodSeconds, int failureThreshold) { assertThat(resource) - .extracting("spec.template.spec.containers").asList() + .extracting("spec.template.spec.containers") + .asInstanceOf(InstanceOfAssertFactories.list(Container.class)) .first() .extracting(type).isNotNull() .hasFieldOrPropertyWithValue("timeoutSeconds", timeoutSeconds) .hasFieldOrPropertyWithValue("periodSeconds", periodSeconds) .hasFieldOrPropertyWithValue("failureThreshold", failureThreshold) .satisfies(r -> assertThat(r) - .extracting("exec.command").asList() + .extracting("exec.command") + .asInstanceOf(InstanceOfAssertFactories.list(String.class)) .first() .isEqualTo(command)); }