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

flarestar.bdd.Assert Maven / Gradle / Ivy

The newest version!
package flarestar.bdd;

import flarestar.bdd.assertions.AssertionInvocationHandler;
import flarestar.bdd.assertions.AssertionInvoker;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * TODO
 */
public class Assert {
    public static AssertionInvoker expect(Object value) {
        return expect(AssertionInvoker.class, value);
    }

    public static AssertionInvoker expect() {
        return expect(AssertionInvoker.class, AssertionInvocationHandler.NO_VALUE);
    }

    public static AssertionInvoker expect(Class assertionInvokerClass, Object value) {
        InvocationHandler handler = new AssertionInvocationHandler(value);
        Class[] implementedInterfaces = new Class[] { assertionInvokerClass };
        return (AssertionInvoker)Proxy.newProxyInstance(Assert.class.getClassLoader(), implementedInterfaces, handler);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy