Skip to content

Commit

Permalink
fix: replace AssertJ's deprecated asList() DSL method in IngressEnric…
Browse files Browse the repository at this point in the history
…herBehavioralTest (3351)

fix: replace AssertJ's deprecated asList() DSL method in IngressEnricherBehavioralTest

Signed-off-by: heap-s <[email protected]>
---
fix: change InstanceOfAssertFactories.LIST to InstanceOfAssertFactories.list(HasMetadata.class)

Signed-off-by: heap-s <[email protected]>
  • Loading branch information
heap-s authored Sep 2, 2024
1 parent 1da32e5 commit c5adc36
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand All @@ -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
Expand All @@ -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();
}
}

0 comments on commit c5adc36

Please sign in to comment.