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

com.codacy.scoobydoo.web.SoftAssertionsWrapper Maven / Gradle / Ivy

There is a newer version: 3.28.3
Show newest version
package com.codacy.scoobydoo.web;

import com.codacy.scoobydoo.LoggingHelper;
import org.testng.asserts.SoftAssert;

public class SoftAssertionsWrapper extends SoftAssert {

    private final SoftAssert softAssert;

    // TODO: this method should be static / Utils class.
    public SoftAssertionsWrapper() {
        this.softAssert = new SoftAssert();
    }

    public SoftAssert getSoftAssert() {
        return softAssert;
    }

    public void assertAll() {
        try {
            softAssert.assertAll();
        } catch (AssertionError e) {
            LoggingHelper.error("Error on soft assertion.", e);
            throw e;
        }
        LoggingHelper.info("All the assertions were right.");
    }

    public void assertEqualsWithLogs(Object actualObject, Object expectedObject, String errorMessage, String loggingMessage) {
        LoggingHelper.info(loggingMessage);
        softAssert.assertEquals(actualObject, expectedObject, errorMessage);
    }

    public void assertTrueWithLogs(Boolean actualBoolean, String errorMessage, String loggingMessage) {
        LoggingHelper.info(loggingMessage);
        softAssert.assertTrue(actualBoolean, errorMessage);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy