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

io.bdeploy.common.util.RuntimeAssert Maven / Gradle / Ivy

Go to download

Public API including dependencies, ready to be used for integrations and plugins.

There is a newer version: 7.3.6
Show newest version
package io.bdeploy.common.util;

import java.util.Objects;

/**
 * Assertion helper for asserting in business logic.
 */
public class RuntimeAssert {

    private RuntimeAssert() {
    }

    public static void assertTrue(boolean condition, String msg) {
        if (!condition) {
            throw new IllegalStateException(msg);
        }
    }

    public static void assertNotNull(Object o, String msg) {
        assertTrue(o != null, msg);
    }

    public static void assertNotNull(Object o) {
        if (o == null) {
            throw new IllegalStateException();
        }
    }

    public static void assertFalse(boolean condition, String msg) {
        assertTrue(!condition, msg);
    }

    public static void assertEquals(Object a, Object b, String msg) {
        assertTrue(Objects.equals(a, b), msg);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy