package org.nzbhydra.mapping.newznab.xml;

import org.assertj.core.util.Objects;

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

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

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

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

        // null safe check
        String actualCode = actual.getCode();
        if (!Objects.areEqual(actualCode, code)) {
            failWithMessage(assertjErrorMessage, actual, code, actualCode);
        }

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

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

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

        // null safe check
        String actualDescription = actual.getDescription();
        if (!Objects.areEqual(actualDescription, description)) {
            failWithMessage(assertjErrorMessage, actual, description, actualDescription);
        }

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

}
