Example usage for org.apache.commons.lang.mutable Mutable getValue

List of usage examples for org.apache.commons.lang.mutable Mutable getValue

Introduction

In this page you can find the example usage for org.apache.commons.lang.mutable Mutable getValue.

Prototype

Object getValue();

Source Link

Document

Gets the value of this mutable.

Usage

From source file:com.ms.commons.test.assertion.impl.ParameterizedAssertion.java

public void doAssert(String methodName) {
    if (table == null) {
        table = database.getTable(0).getName();
    }//w w  w .j a va 2 s.  c om

    Object _instance = (instance instanceof Class<?>) ? null : instance;
    Class<?> _clazz = (clazz == null)
            ? ((instance instanceof Class<?>) ? (Class<?>) instance
                    : ((instance == null) ? null : instance.getClass()))
            : clazz;
    Method _method = (method == null) ? ReflectUtil.getDeclaredMethod(_clazz, methodName) : method;

    MemoryTable memoryTable = database.getTable(table);

    for (MemoryRow memoryRow : memoryTable.getRowList()) {
        Mutable outParameters = new MutableObject();
        Object result = ReflectUtil.invokeMethodByMemoryRow(_instance, _method, memoryRow, outParameters);
        MemoryField field = memoryRow.getField(0);
        Object aspect = TypeConvertUtil.convert(_method.getReturnType(),
                (field.getType() == MemoryFieldType.Null) ? null : field.getValue());

        if (!CompareUtil.isObjectEquals(aspect, result)) {
            throw new AssertException("Call parameterized assertion failed for: " + _clazz + "#" + methodName
                    + " with parameters: " + outParameters.getValue() + " returns: " + result + " but aspects: "
                    + aspect);
        }
    }
}