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

com.sap.cloud.security.ams.dcl.client.dcn.TestAssertion Maven / Gradle / Ivy

The newest version!
/************************************************************************
 * © 2019-2024 SAP SE or an SAP affiliate company. All rights reserved. *
 ************************************************************************/
package com.sap.cloud.security.ams.dcl.client.dcn;

import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;

import com.sap.cloud.security.ams.dcl.client.annotation.Beta;
import com.sap.cloud.security.ams.dcl.client.el.QualifiedName;

@Beta
public class TestAssertion implements Annotated {

    private Object expect;

    private List actions;

    private List resources;

    private List policies;

    private List scopeFilter;

    private List testInputs;

    private Map annotations;

    private transient Object userData; // NOSONAR

    public Object expect() {
        return expect;
    }

    public TestAssertion expect(Object expect) {
        this.expect = expect;
        return this;
    }

    public List actions() {
        return actions;
    }

    public TestAssertion actions(List actions) {
        this.actions = actions;
        return this;
    }

    public List resources() {
        return resources;
    }

    public TestAssertion resources(List resources) {
        this.resources = resources;
        return this;
    }

    public List policies() {
        return policies;
    }

    public TestAssertion policies(List policies) {
        this.policies = policies;
        return this;
    }

    public List scopeFilter() {
        return scopeFilter;
    }

    public TestAssertion scopeFilter(List scopeFilter) {
        this.scopeFilter = scopeFilter;
        return this;
    }

    public List testInputs() {
        return testInputs;
    }

    public TestAssertion testInputs(List testInputs) {
        this.testInputs = testInputs;
        return this;
    }

    @Override
    public Map annotations() {
        return annotations; // NOSONAR
    }

    @Override
    public TestAssertion annotations(Map annotations) {
        this.annotations = annotations; // NOSONAR
        return this;
    }

    /**
     * Gets the custom user data. This data is not stored or loaded (i.e transient). The value is not take into account for hashCode() or
     * equals(Object other).
     * 
     * @return user data
     */
    public Object userData() {
        return userData;
    }

    /**
     * Sets the user data. This data is not stored or loaded (i.e transient). The value is not take into account for hashCode() or equals(Object
     * other).
     * 
     * @param userData
     *            custom user data
     * @return this
     */
    public TestAssertion userData(Object userData) {
        this.userData = userData;
        return this;
    }

    public TestAssertion apply(Consumer consumer) {
        consumer.accept(this);
        return this;
    }

    //

    @Override
    public String toString() {
        return "TestAssertion [expect=" + expect
                + ", actions=" + actions
                + ", resources=" + resources
                + ", policies=" + policies
                + ", scopeFilter=" + scopeFilter
                + ", testInputs=" + testInputs
                + ", annotations=" + annotations
                + "]";
    }

    @Override
    public int hashCode() {
        return Objects.hash(expect, actions, resources, policies, scopeFilter, testInputs, annotations);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        TestAssertion other = (TestAssertion) obj;
        return Objects.equals(expect, other.expect)
                && Objects.equals(actions, other.actions)
                && Objects.equals(resources, other.resources)
                && Objects.equals(policies, other.policies)
                && Objects.equals(scopeFilter, other.scopeFilter)
                && Objects.equals(testInputs, other.testInputs)
                && Objects.equals(annotations, other.annotations);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy