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

io.fabric8.kubernetes.api.model.AbstractHorizontalPodAutoscalerStatusAssert 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 HorizontalPodAutoscalerStatus} specific assertions - Generated by CustomAssertionGenerator.
 */
public abstract class AbstractHorizontalPodAutoscalerStatusAssert, A extends HorizontalPodAutoscalerStatus> extends AbstractAssert {

  /**
   * Creates a new {@link AbstractHorizontalPodAutoscalerStatusAssert} to make assertions on actual HorizontalPodAutoscalerStatus.
   * @param actual the HorizontalPodAutoscalerStatus we want to make assertions on.
   */
  protected AbstractHorizontalPodAutoscalerStatusAssert(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 HorizontalPodAutoscalerStatus 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 HorizontalPodAutoscalerStatus's currentCPUUtilizationPercentage is equal to the given one.
   * @param currentCPUUtilizationPercentage the given currentCPUUtilizationPercentage to compare the actual HorizontalPodAutoscalerStatus's currentCPUUtilizationPercentage to.
   * @return this assertion object.
   * @throws AssertionError - if the actual HorizontalPodAutoscalerStatus's currentCPUUtilizationPercentage is not equal to the given one.
   */
  public S hasCurrentCPUUtilizationPercentage(Integer currentCPUUtilizationPercentage) {
    // check that actual HorizontalPodAutoscalerStatus we want to make assertions on is not null.
    isNotNull();

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

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

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

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

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

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

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

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

  /**
   * Navigates to the property lastScaleTime so that assertions can be done on it
   */
  public org.assertj.core.api.StringAssert lastScaleTime()  {
    // check that actual HorizontalPodAutoscalerStatus we want to make assertions on is not null.
    isNotNull();

    // return the assertion for the property
    return (org.assertj.core.api.StringAssert) assertThat(actual.getLastScaleTime()).describedAs(com.stakater.kubernetes.assertions.Assertions.joinDescription(this, "lastScaleTime"));
  }


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

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

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

}