io.fabric8.kubernetes.api.model.AbstractPodSpecAssert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of assertions Show documentation
Show all versions of assertions Show documentation
A port of Kubernetes Assertions Library by Fabric8
package io.fabric8.kubernetes.api.model;
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.Assertions;
import org.assertj.core.util.Objects;
import org.assertj.core.api.AssertFactory;
import com.stakater.kubernetes.assertions.NavigationListAssert;
import static org.assertj.core.api.Assertions.assertThat;
import static io.fabric8.kubernetes.assertions.internal.Assertions.assertThat;
/**
* Abstract base class for {@link PodSpec} specific assertions - Generated by CustomAssertionGenerator.
*/
public abstract class AbstractPodSpecAssert, A extends PodSpec> extends AbstractAssert {
/**
* Creates a new {@link AbstractPodSpecAssert}
to make assertions on actual PodSpec.
* @param actual the PodSpec we want to make assertions on.
*/
protected AbstractPodSpecAssert(A actual, Class selfType) {
super(actual, selfType);
}
/**
* Verifies that the actual PodSpec's activeDeadlineSeconds is equal to the given one.
* @param activeDeadlineSeconds the given activeDeadlineSeconds to compare the actual PodSpec's activeDeadlineSeconds to.
* @return this assertion object.
* @throws AssertionError - if the actual PodSpec's activeDeadlineSeconds is not equal to the given one.
*/
public S hasActiveDeadlineSeconds(Long activeDeadlineSeconds) {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting activeDeadlineSeconds of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
Long actualActiveDeadlineSeconds = actual.getActiveDeadlineSeconds();
if (!Objects.areEqual(actualActiveDeadlineSeconds, activeDeadlineSeconds)) {
failWithMessage(assertjErrorMessage, actual, activeDeadlineSeconds, actualActiveDeadlineSeconds);
}
// return the current assertion for method chaining
return myself;
}
/**
* Navigates to the property additionalProperties so that assertions can be done on it
*/
public org.assertj.core.api.MapAssert additionalProperties() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.MapAssert) assertThat(actual.getAdditionalProperties()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "additionalProperties"));
}
/**
* Navigates to the property affinity so that assertions can be done on it
*/
public AffinityAssert affinity() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (AffinityAssert) assertThat(actual.getAffinity()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "affinity"));
}
/**
* Navigates to the property automountServiceAccountToken so that assertions can be done on it
*/
public org.assertj.core.api.BooleanAssert automountServiceAccountToken() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.BooleanAssert) assertThat(actual.getAutomountServiceAccountToken()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "automountServiceAccountToken"));
}
/**
* Navigates to the property containers so that assertions can be done on it
*/
public NavigationListAssert containers() {
isNotNull();
// return the assertion for the property
AssertFactory assertFactory = new AssertFactory() {
public ContainerAssert createAssert(Container t) {
return (ContainerAssert) assertThat(t);
}
};
NavigationListAssert answer = new NavigationListAssert(actual.getContainers(), assertFactory);
answer.describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "containers"));
return answer;
}
/**
* Navigates to the property dnsPolicy so that assertions can be done on it
*/
public org.assertj.core.api.StringAssert dnsPolicy() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.StringAssert) assertThat(actual.getDnsPolicy()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "dnsPolicy"));
}
/**
* Navigates to the property hostAliases so that assertions can be done on it
*/
public NavigationListAssert hostAliases() {
isNotNull();
// return the assertion for the property
AssertFactory assertFactory = new AssertFactory() {
public HostAliasAssert createAssert(HostAlias t) {
return (HostAliasAssert) assertThat(t);
}
};
NavigationListAssert answer = new NavigationListAssert(actual.getHostAliases(), assertFactory);
answer.describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "hostAliases"));
return answer;
}
/**
* Navigates to the property hostIPC so that assertions can be done on it
*/
public org.assertj.core.api.BooleanAssert hostIPC() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.BooleanAssert) assertThat(actual.getHostIPC()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "hostIPC"));
}
/**
* Navigates to the property hostNetwork so that assertions can be done on it
*/
public org.assertj.core.api.BooleanAssert hostNetwork() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.BooleanAssert) assertThat(actual.getHostNetwork()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "hostNetwork"));
}
/**
* Navigates to the property hostPID so that assertions can be done on it
*/
public org.assertj.core.api.BooleanAssert hostPID() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.BooleanAssert) assertThat(actual.getHostPID()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "hostPID"));
}
/**
* Navigates to the property hostname so that assertions can be done on it
*/
public org.assertj.core.api.StringAssert hostname() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.StringAssert) assertThat(actual.getHostname()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "hostname"));
}
/**
* Navigates to the property imagePullSecrets so that assertions can be done on it
*/
public NavigationListAssert imagePullSecrets() {
isNotNull();
// return the assertion for the property
AssertFactory assertFactory = new AssertFactory() {
public LocalObjectReferenceAssert createAssert(LocalObjectReference t) {
return (LocalObjectReferenceAssert) assertThat(t);
}
};
NavigationListAssert answer = new NavigationListAssert(actual.getImagePullSecrets(), assertFactory);
answer.describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "imagePullSecrets"));
return answer;
}
/**
* Navigates to the property initContainers so that assertions can be done on it
*/
public NavigationListAssert initContainers() {
isNotNull();
// return the assertion for the property
AssertFactory assertFactory = new AssertFactory() {
public ContainerAssert createAssert(Container t) {
return (ContainerAssert) assertThat(t);
}
};
NavigationListAssert answer = new NavigationListAssert(actual.getInitContainers(), assertFactory);
answer.describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "initContainers"));
return answer;
}
/**
* Navigates to the property nodeName so that assertions can be done on it
*/
public org.assertj.core.api.StringAssert nodeName() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.StringAssert) assertThat(actual.getNodeName()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "nodeName"));
}
/**
* Navigates to the property nodeSelector so that assertions can be done on it
*/
public org.assertj.core.api.MapAssert nodeSelector() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.MapAssert) assertThat(actual.getNodeSelector()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "nodeSelector"));
}
/**
* Navigates to the property restartPolicy so that assertions can be done on it
*/
public org.assertj.core.api.StringAssert restartPolicy() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.StringAssert) assertThat(actual.getRestartPolicy()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "restartPolicy"));
}
/**
* Navigates to the property schedulerName so that assertions can be done on it
*/
public org.assertj.core.api.StringAssert schedulerName() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.StringAssert) assertThat(actual.getSchedulerName()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "schedulerName"));
}
/**
* Navigates to the property securityContext so that assertions can be done on it
*/
public PodSecurityContextAssert securityContext() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (PodSecurityContextAssert) assertThat(actual.getSecurityContext()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "securityContext"));
}
/**
* Navigates to the property serviceAccount so that assertions can be done on it
*/
public org.assertj.core.api.StringAssert serviceAccount() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.StringAssert) assertThat(actual.getServiceAccount()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "serviceAccount"));
}
/**
* Navigates to the property serviceAccountName so that assertions can be done on it
*/
public org.assertj.core.api.StringAssert serviceAccountName() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.StringAssert) assertThat(actual.getServiceAccountName()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "serviceAccountName"));
}
/**
* Navigates to the property subdomain so that assertions can be done on it
*/
public org.assertj.core.api.StringAssert subdomain() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (org.assertj.core.api.StringAssert) assertThat(actual.getSubdomain()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "subdomain"));
}
/**
* Verifies that the actual PodSpec's terminationGracePeriodSeconds is equal to the given one.
* @param terminationGracePeriodSeconds the given terminationGracePeriodSeconds to compare the actual PodSpec's terminationGracePeriodSeconds to.
* @return this assertion object.
* @throws AssertionError - if the actual PodSpec's terminationGracePeriodSeconds is not equal to the given one.
*/
public S hasTerminationGracePeriodSeconds(Long terminationGracePeriodSeconds) {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// overrides the default error message with a more explicit one
String assertjErrorMessage = "\nExpecting terminationGracePeriodSeconds of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
Long actualTerminationGracePeriodSeconds = actual.getTerminationGracePeriodSeconds();
if (!Objects.areEqual(actualTerminationGracePeriodSeconds, terminationGracePeriodSeconds)) {
failWithMessage(assertjErrorMessage, actual, terminationGracePeriodSeconds, actualTerminationGracePeriodSeconds);
}
// return the current assertion for method chaining
return myself;
}
/**
* Navigates to the property tolerations so that assertions can be done on it
*/
public NavigationListAssert tolerations() {
isNotNull();
// return the assertion for the property
AssertFactory assertFactory = new AssertFactory() {
public TolerationAssert createAssert(Toleration t) {
return (TolerationAssert) assertThat(t);
}
};
NavigationListAssert answer = new NavigationListAssert(actual.getTolerations(), assertFactory);
answer.describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "tolerations"));
return answer;
}
/**
* Navigates to the property volumes so that assertions can be done on it
*/
public NavigationListAssert volumes() {
isNotNull();
// return the assertion for the property
AssertFactory assertFactory = new AssertFactory() {
public VolumeAssert createAssert(Volume t) {
return (VolumeAssert) assertThat(t);
}
};
NavigationListAssert answer = new NavigationListAssert(actual.getVolumes(), assertFactory);
answer.describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "volumes"));
return answer;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy