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

com.github.leeonky.dal.AssertResult Maven / Gradle / Ivy

There is a newer version: 0.8.1-alpha.6
Show newest version
package com.github.leeonky.dal;

public class AssertResult {
    private final boolean passed;
    private final String message;

    private AssertResult(boolean passed, String message) {
        this.passed = passed;
        this.message = message;
    }

    public static AssertResult passedResult() {
        return new AssertResult(true, null);
    }

    public static AssertResult failedResult(Object actual, String expression) {
        String message = expression.isEmpty() ?
                String.format("Expected root value to be [true] but was <%s>", actual)
                : String.format("Expected value to be [%s] but was <%s>", expression, actual);
        return new AssertResult(false, message);
    }

    public boolean isPassed() {
        return passed;
    }

    public String getMessage() {
        return message;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy