From 487021f1a50fbf3a7269286e61dd119e2349c67c Mon Sep 17 00:00:00 2001 From: bhiwagade-rahul Date: Fri, 31 May 2024 10:09:40 +0530 Subject: [PATCH] fix: replace AssertJ's deprecated asList() DSL method in DaemonSetHandlerTest (3118) Update DaemonSetHandlerTest.java DaemonSetHandlerTest : Convert member field to a local variable #3108 --- Update class name --- Update DaemonSetHandlerTest.java import of InstanceOfAssertFactories not present in file --- .../jkube/kit/enricher/handler/DaemonSetHandlerTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/handler/DaemonSetHandlerTest.java b/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/handler/DaemonSetHandlerTest.java index 877682d179..29ddf040d6 100644 --- a/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/handler/DaemonSetHandlerTest.java +++ b/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/handler/DaemonSetHandlerTest.java @@ -15,10 +15,11 @@ import java.util.ArrayList; import java.util.List; - +import org.assertj.core.api.InstanceOfAssertFactories; import io.fabric8.kubernetes.api.model.PodSpec; import io.fabric8.kubernetes.api.model.PodTemplateSpec; import io.fabric8.kubernetes.api.model.apps.DaemonSetSpec; +import io.fabric8.kubernetes.api.model.Volume; import org.eclipse.jkube.kit.common.JavaProject; import org.eclipse.jkube.kit.config.image.ImageConfiguration; import org.eclipse.jkube.kit.config.image.build.BuildConfiguration; @@ -26,6 +27,7 @@ import org.eclipse.jkube.kit.config.resource.GroupArtifactVersion; import org.eclipse.jkube.kit.config.resource.VolumeConfig; + import io.fabric8.kubernetes.api.model.KubernetesListBuilder; import io.fabric8.kubernetes.api.model.apps.DaemonSet; import org.junit.jupiter.api.BeforeEach; @@ -37,14 +39,13 @@ class DaemonSetHandlerTest { - private ProbeHandler probeHandler; private List volumes; private List images; private DaemonSetHandler daemonSetHandler; @BeforeEach void before(){ - probeHandler = mock(ProbeHandler.class); + ProbeHandler probeHandler = new ProbeHandler(); volumes = new ArrayList<>(); images = new ArrayList<>(); List mounts = new ArrayList<>(); @@ -100,7 +101,7 @@ void get_withValidControllerName_shouldReturnConfigWithContainers() { .extracting(DaemonSetSpec::getTemplate).isNotNull() .extracting(PodTemplateSpec::getSpec) .extracting(PodSpec::getVolumes).isNotNull() - .asList() + .asInstanceOf(InstanceOfAssertFactories.list(Volume.class)) .first() .hasFieldOrPropertyWithValue("hostPath.path", "/test/path") );