/** * Copyright (C) 2015 Orion Health (Orchestral Development Ltd) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package xbdd.report.assertions; import static org.assertj.core.util.Objects.areEqual; import org.assertj.core.api.AbstractAssert; import xbdd.report.StepSummary; /** * {@link StepSummary} specific assertions - Generated by CustomAssertionGenerator. */ public class StepSummaryAssert extends AbstractAssert<StepSummaryAssert, StepSummary> { /** * Creates a new <code>{@link StepSummaryAssert}</code> to make assertions on actual StepSummary. * * @param actual the StepSummary we want to make assertions on. */ public StepSummaryAssert(final StepSummary actual) { super(actual, StepSummaryAssert.class); } /** * An entry point for StepSummaryAssert to follow AssertJ standard <code>assertThat()</code> statements.<br> * With a static import, one can write directly: <code>assertThat(myStepSummary)</code> and get specific assertion with code completion. * * @param actual the StepSummary we want to make assertions on. * @return a new <code>{@link StepSummaryAssert}</code> */ public static StepSummaryAssert assertThat(final StepSummary actual) { return new StepSummaryAssert(actual); } /** * Verifies that the actual StepSummary's status is equal to the given one. * * @param status the given status to compare the actual StepSummary's status to. * @return this assertion object. * @throws AssertionError - if the actual StepSummary's status is not equal to the given one. */ public StepSummaryAssert hasStatus(final String status) { // check that actual StepSummary we want to make assertions on is not null. isNotNull(); // overrides the default error message with a more explicit one final String assertjErrorMessage = "\nExpected status of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // null safe check final String actualStatus = this.actual.getStatus(); if (!areEqual(actualStatus, status)) { failWithMessage(assertjErrorMessage, this.actual, status, actualStatus); } // return the current assertion for method chaining return this; } /** * Verifies that the actual StepSummary's step is equal to the given one. * * @param step the given step to compare the actual StepSummary's step to. * @return this assertion object. * @throws AssertionError - if the actual StepSummary's step is not equal to the given one. */ public StepSummaryAssert hasStep(final String step) { // check that actual StepSummary we want to make assertions on is not null. isNotNull(); // overrides the default error message with a more explicit one final String assertjErrorMessage = "\nExpected step of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // null safe check final String actualStep = this.actual.getStep(); if (!areEqual(actualStep, step)) { failWithMessage(assertjErrorMessage, this.actual, step, actualStep); } // return the current assertion for method chaining return this; } }