Skip to content

Commit

Permalink
fix: replace AssertJ's deprecated asList() DSL method in ProbeHandler…
Browse files Browse the repository at this point in the history
…Test (3278)
  • Loading branch information
vijaybhagwat24 authored Jul 26, 2024
1 parent b6bf539 commit e1cde0b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.eclipse.jkube.kit.enricher.handler;

import io.fabric8.kubernetes.api.model.ExecAction;
import io.fabric8.kubernetes.api.model.HTTPHeader;
import io.fabric8.kubernetes.api.model.IntOrString;
import io.fabric8.kubernetes.api.model.Probe;
import org.eclipse.jkube.kit.config.resource.ProbeConfig;
Expand All @@ -25,6 +26,7 @@

import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.assertj.core.api.InstanceOfAssertFactories.list;

class ProbeHandlerTest {
private Probe probe;
Expand Down Expand Up @@ -105,7 +107,7 @@ void getExecProbe_withExec() {
.hasFieldOrPropertyWithValue("httpGet", null)
.hasFieldOrPropertyWithValue("tcpSocket", null)
.extracting(Probe::getExec).isNotNull()
.extracting(ExecAction::getCommand).asList()
.extracting(ExecAction::getCommand).asInstanceOf(list(String.class))
.hasSize(2)
.containsExactly("cat", "/tmp/probe");
}
Expand Down Expand Up @@ -270,11 +272,12 @@ void httpGetProbe_withCustomHeaders() {
.hasFieldOrPropertyWithValue("httpGet.host", "www.example.com")
.hasFieldOrPropertyWithValue("httpGet.port", new IntOrString(8080))
.hasFieldOrPropertyWithValue("httpGet.scheme", "HTTPS")
.satisfies(p -> assertThat(p).extracting("httpGet.httpHeaders").asList().element(0)
.satisfies(p -> assertThat(p).extracting("httpGet.httpHeaders")
.asInstanceOf(list(HTTPHeader.class)).element(0)
.hasFieldOrPropertyWithValue("name", "Accept")
.hasFieldOrPropertyWithValue("value", "application/json")
)
.satisfies(p -> assertThat(p).extracting("httpGet.httpHeaders").asList().element(1)
.satisfies(p -> assertThat(p).extracting("httpGet.httpHeaders").asInstanceOf(list(HTTPHeader.class)).element(1)
.hasFieldOrPropertyWithValue("name", "User-Agent")
.hasFieldOrPropertyWithValue("value", "MyUserAgent")
);
Expand Down

0 comments on commit e1cde0b

Please sign in to comment.