All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.fabric8.kubernetes.api.model.AbstractHorizontalPodAutoscalerSpecAssert Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show 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 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 HorizontalPodAutoscalerSpec} specific assertions - Generated by CustomAssertionGenerator.
 */
public abstract class AbstractHorizontalPodAutoscalerSpecAssert, A extends HorizontalPodAutoscalerSpec> extends AbstractAssert {

  /**
   * Creates a new {@link AbstractHorizontalPodAutoscalerSpecAssert} to make assertions on actual HorizontalPodAutoscalerSpec.
   * @param actual the HorizontalPodAutoscalerSpec we want to make assertions on.
   */
  protected AbstractHorizontalPodAutoscalerSpecAssert(A actual, Class selfType) {
    super(actual, selfType);
  }


  /**
   * Navigates to the property additionalProperties so that assertions can be done on it
   */
  public org.assertj.core.api.MapAssert additionalProperties()  {
    // check that actual HorizontalPodAutoscalerSpec 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"));
  }


  /**
   * Verifies that the actual HorizontalPodAutoscalerSpec's maxReplicas is equal to the given one.
   * @param maxReplicas the given maxReplicas to compare the actual HorizontalPodAutoscalerSpec's maxReplicas to.
   * @return this assertion object.
   * @throws AssertionError - if the actual HorizontalPodAutoscalerSpec's maxReplicas is not equal to the given one.
   */
  public S hasMaxReplicas(Integer maxReplicas) {
    // check that actual HorizontalPodAutoscalerSpec we want to make assertions on is not null.
    isNotNull();

    // overrides the default error message with a more explicit one
    String assertjErrorMessage = "\nExpecting maxReplicas of:\n  <%s>\nto be:\n  <%s>\nbut was:\n  <%s>";
    
    // null safe check
    Integer actualMaxReplicas = actual.getMaxReplicas();
    if (!Objects.areEqual(actualMaxReplicas, maxReplicas)) {
      failWithMessage(assertjErrorMessage, actual, maxReplicas, actualMaxReplicas);
    }

    // return the current assertion for method chaining
    return myself;
  }

  /**
   * Verifies that the actual HorizontalPodAutoscalerSpec's minReplicas is equal to the given one.
   * @param minReplicas the given minReplicas to compare the actual HorizontalPodAutoscalerSpec's minReplicas to.
   * @return this assertion object.
   * @throws AssertionError - if the actual HorizontalPodAutoscalerSpec's minReplicas is not equal to the given one.
   */
  public S hasMinReplicas(Integer minReplicas) {
    // check that actual HorizontalPodAutoscalerSpec we want to make assertions on is not null.
    isNotNull();

    // overrides the default error message with a more explicit one
    String assertjErrorMessage = "\nExpecting minReplicas of:\n  <%s>\nto be:\n  <%s>\nbut was:\n  <%s>";
    
    // null safe check
    Integer actualMinReplicas = actual.getMinReplicas();
    if (!Objects.areEqual(actualMinReplicas, minReplicas)) {
      failWithMessage(assertjErrorMessage, actual, minReplicas, actualMinReplicas);
    }

    // return the current assertion for method chaining
    return myself;
  }

  /**
   * Navigates to the property scaleTargetRef so that assertions can be done on it
   */
  public CrossVersionObjectReferenceAssert scaleTargetRef()  {
    // check that actual HorizontalPodAutoscalerSpec we want to make assertions on is not null.
    isNotNull();

    // return the assertion for the property
    return (CrossVersionObjectReferenceAssert) assertThat(actual.getScaleTargetRef()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "scaleTargetRef"));
  }


  /**
   * Verifies that the actual HorizontalPodAutoscalerSpec's targetCPUUtilizationPercentage is equal to the given one.
   * @param targetCPUUtilizationPercentage the given targetCPUUtilizationPercentage to compare the actual HorizontalPodAutoscalerSpec's targetCPUUtilizationPercentage to.
   * @return this assertion object.
   * @throws AssertionError - if the actual HorizontalPodAutoscalerSpec's targetCPUUtilizationPercentage is not equal to the given one.
   */
  public S hasTargetCPUUtilizationPercentage(Integer targetCPUUtilizationPercentage) {
    // check that actual HorizontalPodAutoscalerSpec we want to make assertions on is not null.
    isNotNull();

    // overrides the default error message with a more explicit one
    String assertjErrorMessage = "\nExpecting targetCPUUtilizationPercentage of:\n  <%s>\nto be:\n  <%s>\nbut was:\n  <%s>";
    
    // null safe check
    Integer actualTargetCPUUtilizationPercentage = actual.getTargetCPUUtilizationPercentage();
    if (!Objects.areEqual(actualTargetCPUUtilizationPercentage, targetCPUUtilizationPercentage)) {
      failWithMessage(assertjErrorMessage, actual, targetCPUUtilizationPercentage, actualTargetCPUUtilizationPercentage);
    }

    // return the current assertion for method chaining
    return myself;
  }

}