From 78e8631c9c101e52dc94f14fb97c16383396afc5 Mon Sep 17 00:00:00 2001 From: Shivam <96533413+ShivamChavan01@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:51:56 +0530 Subject: [PATCH] fix: replace AssertJ's deprecated asList() DSL method in PodTemplateHandlerTest (3465) Replaced asList() method with asInstanceOf(InstanceOfAssertFactories.list(Type.class) --- Replaced asList() method with asInstanceOf(InstanceOfAssertFactories.list(Type.class) --- repushing the code dueto some failuers --- .../enricher/handler/PodTemplateHandlerTest.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/handler/PodTemplateHandlerTest.java b/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/handler/PodTemplateHandlerTest.java index 137b7c6270..1585a133af 100644 --- a/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/handler/PodTemplateHandlerTest.java +++ b/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/handler/PodTemplateHandlerTest.java @@ -16,6 +16,8 @@ import io.fabric8.kubernetes.api.model.LocalObjectReference; import io.fabric8.kubernetes.api.model.PodSpec; import io.fabric8.kubernetes.api.model.PodTemplateSpec; +import io.fabric8.kubernetes.api.model.Volume; +import io.fabric8.kubernetes.api.model.Container; import org.assertj.core.api.InstanceOfAssertFactories; import org.eclipse.jkube.kit.config.image.build.BuildConfiguration; import org.eclipse.jkube.kit.config.image.ImageConfiguration; @@ -87,7 +89,7 @@ void getPodTemplate_withoutVolumeConfig_shouldGeneratePodTemplateWithoutVolume() assertThat(podTemplateSpec.getSpec().getVolumes()).isEmpty(); assertThat(podTemplateSpec.getSpec()) .extracting(PodSpec::getContainers).isNotNull() - .asList() + .asInstanceOf(InstanceOfAssertFactories.list(Container.class)) .first() .hasFieldOrPropertyWithValue("name", "test-app") .hasFieldOrPropertyWithValue("image", "docker.io/test:latest") @@ -105,10 +107,10 @@ void getPodTemplate_withEmptyVolumeAndWithoutServiceAccount_shouldGeneratePodTem PodTemplateSpec podTemplateSpec = podTemplateHandler.getPodTemplate(config, null, images); assertThat(podTemplateSpec.getSpec()) - .hasFieldOrPropertyWithValue("serviceAccountName", null) - .returns(true, spec -> spec.getVolumes().isEmpty()) - .extracting(PodSpec::getContainers) - .isNotNull(); + .hasFieldOrPropertyWithValue("serviceAccountName", null) + .returns(true, spec -> spec.getVolumes().isEmpty()) + .extracting(PodSpec::getContainers) + .isNotNull(); } @Test @@ -128,7 +130,8 @@ void getPodTemplate_withVolumeAndServiceAccount_shouldGeneratePodTemplateWithCon assertThat(podTemplateSpec.getSpec().getContainers()).isNotNull(); assertThat(podTemplateSpec.getSpec()) - .extracting(PodSpec::getVolumes).asList() + .extracting(PodSpec::getVolumes) + .asInstanceOf(InstanceOfAssertFactories.list(Volume.class)) .isNotEmpty() .first() .hasFieldOrPropertyWithValue("name", "test")