package org.nzbhydra;

import org.assertj.core.api.AbstractObjectAssert;
import org.assertj.core.util.Objects;

/**
 * Abstract base class for {@link GenericResponse} specific assertions - Generated by CustomAssertionGenerator.
 */
@jakarta.annotation.Generated(value = "assertj-assertions-generator")
public abstract class AbstractGenericResponseAssert<S extends AbstractGenericResponseAssert<S, A>, A extends GenericResponse> extends AbstractObjectAssert<S, A> {

    /**
     * Creates a new <code>{@link AbstractGenericResponseAssert}</code> to make assertions on actual GenericResponse.
     *
     * @param actual the GenericResponse we want to make assertions on.
     */
    protected AbstractGenericResponseAssert(A actual, Class<S> selfType) {
        super(actual, selfType);
    }

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

        // overrides the default error message with a more explicit one
        String assertjErrorMessage = "\nExpecting message of:\n  <%s>\nto be:\n  <%s>\nbut was:\n  <%s>";

        // null safe check
        String actualMessage = actual.getMessage();
        if (!Objects.areEqual(actualMessage, message)) {
            failWithMessage(assertjErrorMessage, actual, message, actualMessage);
        }

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

    /**
     * Verifies that the actual GenericResponse is successful.
     *
     * @return this assertion object.
     * @throws AssertionError - if the actual GenericResponse is not successful.
     */
    public S isSuccessful() {
        // check that actual GenericResponse we want to make assertions on is not null.
        isNotNull();

        // check that property call/field access is true
        if (!actual.isSuccessful()) {
            failWithMessage("\nExpecting that actual GenericResponse is successful but is not.");
        }

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

    /**
     * Verifies that the actual GenericResponse is not successful.
     *
     * @return this assertion object.
     * @throws AssertionError - if the actual GenericResponse is successful.
     */
    public S isNotSuccessful() {
        // check that actual GenericResponse we want to make assertions on is not null.
        isNotNull();

        // check that property call/field access is false
        if (actual.isSuccessful()) {
            failWithMessage("\nExpecting that actual GenericResponse is not successful but is.");
        }

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

}
