Skip to content

Commit

Permalink
fix: replace AssertJ's deprecated asList() DSL method in DaemonSetHan…
Browse files Browse the repository at this point in the history
…dlerTest (3118)

Update DaemonSetHandlerTest.java

DaemonSetHandlerTest : Convert member field to a local variable eclipse-jkube#3108
---
Update class name
---
Update DaemonSetHandlerTest.java

import of InstanceOfAssertFactories not present in file
  • Loading branch information
bhiwagade-rahul authored May 31, 2024
1 parent ed6d0ed commit 487021f
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@

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;
import org.eclipse.jkube.kit.config.resource.ControllerResourceConfig;
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;
Expand All @@ -37,14 +39,13 @@

class DaemonSetHandlerTest {

private ProbeHandler probeHandler;
private List<VolumeConfig> volumes;
private List<ImageConfiguration> images;
private DaemonSetHandler daemonSetHandler;

@BeforeEach
void before(){
probeHandler = mock(ProbeHandler.class);
ProbeHandler probeHandler = new ProbeHandler();
volumes = new ArrayList<>();
images = new ArrayList<>();
List<String> mounts = new ArrayList<>();
Expand Down Expand Up @@ -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")
);
Expand Down

0 comments on commit 487021f

Please sign in to comment.