From c5adc3680f9e44460ec2851a07aa140744d30b06 Mon Sep 17 00:00:00 2001 From: Dakota Dunn <159508874+heap-s@users.noreply.github.com> Date: Mon, 2 Sep 2024 00:44:15 -0700 Subject: [PATCH] fix: replace AssertJ's deprecated asList() DSL method in IngressEnricherBehavioralTest (3351) fix: replace AssertJ's deprecated asList() DSL method in IngressEnricherBehavioralTest Signed-off-by: heap-s --- fix: change InstanceOfAssertFactories.LIST to InstanceOfAssertFactories.list(HasMetadata.class) Signed-off-by: heap-s --- .../generic/IngressEnricherBehavioralTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/jkube-kit/enricher/generic/src/test/java/org/eclipse/jkube/enricher/generic/IngressEnricherBehavioralTest.java b/jkube-kit/enricher/generic/src/test/java/org/eclipse/jkube/enricher/generic/IngressEnricherBehavioralTest.java index 7d84b28f87..8a1d1c0904 100644 --- a/jkube-kit/enricher/generic/src/test/java/org/eclipse/jkube/enricher/generic/IngressEnricherBehavioralTest.java +++ b/jkube-kit/enricher/generic/src/test/java/org/eclipse/jkube/enricher/generic/IngressEnricherBehavioralTest.java @@ -13,10 +13,13 @@ */ package org.eclipse.jkube.enricher.generic; +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.Service; import io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder; + +import org.assertj.core.api.InstanceOfAssertFactories; import org.eclipse.jkube.kit.common.JavaProject; import org.eclipse.jkube.kit.common.KitLogger; import org.eclipse.jkube.kit.config.resource.PlatformMode; @@ -53,7 +56,7 @@ void create_withNoServices_shouldNotCreateIngress() { // When new IngressEnricher(context).create(PlatformMode.kubernetes, klb); // Then - assertThat(klb.build()).extracting(KubernetesList::getItems).asList().isEmpty(); + assertThat(klb.build()).extracting(KubernetesList::getItems).asInstanceOf(InstanceOfAssertFactories.list(HasMetadata.class)).isEmpty(); } @Test @@ -64,7 +67,7 @@ void create_withServicesAndNoExternalUrls_shouldNotCreateIngress() { // When new IngressEnricher(context).create(PlatformMode.kubernetes, klb); // Then - assertThat(klb.build()).extracting(KubernetesList::getItems).asList().singleElement() + assertThat(klb.build()).extracting(KubernetesList::getItems).asInstanceOf(InstanceOfAssertFactories.list(HasMetadata.class)).singleElement() .isInstanceOf(Service.class); } @@ -112,7 +115,7 @@ void create_withServiceNotExposed_shouldNotCreateIngress() { // When new IngressEnricher(context).create(PlatformMode.kubernetes, klb); // Then - assertThat(klb.build()).extracting(KubernetesList::getItems).asList().singleElement() + assertThat(klb.build()).extracting(KubernetesList::getItems).asInstanceOf(InstanceOfAssertFactories.list(HasMetadata.class)).singleElement() .isInstanceOf(Service.class); } @@ -131,7 +134,7 @@ void create_withServices_shouldCreateNetworkingIngress() { .hasFieldOrPropertyWithValue("metadata.name", "http") .hasFieldOrPropertyWithValue("spec.defaultBackend.service.name", "http") .hasFieldOrPropertyWithValue("spec.defaultBackend.service.port.number", 80) - .extracting("spec.rules").asList().isEmpty(); + .extracting("spec.rules").asInstanceOf(InstanceOfAssertFactories.list(HasMetadata.class)).isEmpty(); } @Test @@ -150,6 +153,6 @@ void create_withServicesAndTargetExtensions_shouldCreateExtensionsIngress() { .hasFieldOrPropertyWithValue("metadata.name", "http") .hasFieldOrPropertyWithValue("spec.backend.serviceName", "http") .hasFieldOrPropertyWithValue("spec.backend.servicePort.value", 80) - .extracting("spec.rules").asList().isEmpty(); + .extracting("spec.rules").asInstanceOf(InstanceOfAssertFactories.list(HasMetadata.class)).isEmpty(); } }