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

com.greenpepper.call.Result Maven / Gradle / Ivy

The newest version!
package com.greenpepper.call;

import com.greenpepper.expectation.Expectation;

/**
 * 

Result class.

* * @author oaouattara * @version $Id: $Id */ public final class Result { private Expectation expectation; private Object actual; private Throwable exception; /** *

Constructor for Result.

*/ public Result() { } /** *

Constructor for Result.

* * @param expectation a {@link com.greenpepper.expectation.Expectation} object. */ public Result( Expectation expectation ) { this.expectation = expectation; } /** *

isIgnored.

* * @return a boolean. */ public boolean isIgnored() { return !isException() && expectation == null; } /** *

isRight.

* * @return a boolean. */ public boolean isRight() { return !isException() && !isIgnored() && expectation.meets( actual ); } /** *

isWrong.

* * @return a boolean. */ public boolean isWrong() { return !isException() && !isIgnored() && !isRight(); } /** *

isException.

* * @return a boolean. */ public boolean isException() { return exception != null; } /** *

Setter for the field actual.

* * @param actual a {@link java.lang.Object} object. */ public void setActual( Object actual ) { this.actual = actual; } /** *

getExpected.

* * @return a {@link com.greenpepper.expectation.Expectation} object. */ public Expectation getExpected() { return expectation; } /** *

Getter for the field actual.

* * @return a {@link java.lang.Object} object. */ public Object getActual() { return actual; } /** *

exceptionOccured.

* * @param t a {@link java.lang.Throwable} object. */ public void exceptionOccured( Throwable t ) { if (!isIgnored() && expectation.meets( t )) { actual = t; } else { exception = t; } } /** *

Getter for the field exception.

* * @return a {@link java.lang.Throwable} object. */ public Throwable getException() { return exception; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy