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 kubernetes-assertions
Show all versions of kubernetes-assertions
This library provides a bunch of helpful assertj assertions for working with the kubernetes-api.
The newest version!
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 io.fabric8.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(io.fabric8.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(io.fabric8.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(io.fabric8.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(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "containers"));
return answer;
}
/**
* Navigates to the property dnsConfig so that assertions can be done on it
*/
public PodDNSConfigAssert dnsConfig() {
// check that actual PodSpec we want to make assertions on is not null.
isNotNull();
// return the assertion for the property
return (PodDNSConfigAssert) assertThat(actual.getDnsConfig()).describedAs(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "dnsConfig"));
}
/**
* 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(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "dnsPolicy"));
}
/**
* Navigates to the property enableServiceLinks so that assertions can be done on it
*/
public org.assertj.core.api.BooleanAssert enableServiceLinks() {
// 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.getEnableServiceLinks()).describedAs(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "enableServiceLinks"));
}
/**
* Navigates to the property ephemeralContainers so that assertions can be done on it
*/
public NavigationListAssert ephemeralContainers() {
isNotNull();
// return the assertion for the property
AssertFactory assertFactory = new AssertFactory() {
public EphemeralContainerAssert createAssert(EphemeralContainer t) {
return (EphemeralContainerAssert) assertThat(t);
}
};
NavigationListAssert answer = new NavigationListAssert(actual.getEphemeralContainers(), assertFactory);
answer.describedAs(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "ephemeralContainers"));
return answer;
}
/**
* 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(io.fabric8.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(io.fabric8.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(io.fabric8.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(io.fabric8.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(io.fabric8.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(io.fabric8.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(io.fabric8.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(io.fabric8.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(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "nodeSelector"));
}
/**
* Navigates to the property overhead so that assertions can be done on it
*/
public org.assertj.core.api.MapAssert overhead() {
// 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.getOverhead()).describedAs(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "overhead"));
}
/**
* Navigates to the property preemptionPolicy so that assertions can be done on it
*/
public org.assertj.core.api.StringAssert preemptionPolicy() {
// 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.getPreemptionPolicy()).describedAs(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "preemptionPolicy"));
}
/**
* Verifies that the actual PodSpec's priority is equal to the given one.
* @param priority the given priority to compare the actual PodSpec's priority to.
* @return this assertion object.
* @throws AssertionError - if the actual PodSpec's priority is not equal to the given one.
*/
public S hasPriority(Integer priority) {
// 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 priority of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>";
// null safe check
Integer actualPriority = actual.getPriority();
if (!Objects.areEqual(actualPriority, priority)) {
failWithMessage(assertjErrorMessage, actual, priority, actualPriority);
}
// return the current assertion for method chaining
return myself;
}
/**
* Navigates to the property priorityClassName so that assertions can be done on it
*/
public org.assertj.core.api.StringAssert priorityClassName() {
// 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.getPriorityClassName()).describedAs(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "priorityClassName"));
}
/**
* Navigates to the property readinessGates so that assertions can be done on it
*/
public NavigationListAssert readinessGates() {
isNotNull();
// return the assertion for the property
AssertFactory assertFactory = new AssertFactory() {
public PodReadinessGateAssert createAssert(PodReadinessGate t) {
return (PodReadinessGateAssert) assertThat(t);
}
};
NavigationListAssert answer = new NavigationListAssert(actual.getReadinessGates(), assertFactory);
answer.describedAs(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "readinessGates"));
return answer;
}
/**
* 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(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "restartPolicy"));
}
/**
* Navigates to the property runtimeClassName so that assertions can be done on it
*/
public org.assertj.core.api.StringAssert runtimeClassName() {
// 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.getRuntimeClassName()).describedAs(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "runtimeClassName"));
}
/**
* 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(io.fabric8.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(io.fabric8.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(io.fabric8.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(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "serviceAccountName"));
}
/**
* Navigates to the property shareProcessNamespace so that assertions can be done on it
*/
public org.assertj.core.api.BooleanAssert shareProcessNamespace() {
// 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.getShareProcessNamespace()).describedAs(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "shareProcessNamespace"));
}
/**
* 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(io.fabric8.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(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "tolerations"));
return answer;
}
/**
* Navigates to the property topologySpreadConstraints so that assertions can be done on it
*/
public NavigationListAssert topologySpreadConstraints() {
isNotNull();
// return the assertion for the property
AssertFactory assertFactory = new AssertFactory() {
public TopologySpreadConstraintAssert createAssert(TopologySpreadConstraint t) {
return (TopologySpreadConstraintAssert) assertThat(t);
}
};
NavigationListAssert answer = new NavigationListAssert(actual.getTopologySpreadConstraints(), assertFactory);
answer.describedAs(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "topologySpreadConstraints"));
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(io.fabric8.kubernetes.assertions.Assertions.joinDescription(this, "volumes"));
return answer;
}
}