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

com.greenpepper.interpreter.flow.scenario.Expectation Maven / Gradle / Ivy

There is a newer version: 4.2.4
Show newest version

/**
 * Copyright (c) 2009 Pyxis Technologies inc.
 *
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA,
 * or see the FSF site: http://www.fsf.org.
 *
 * @author oaouattara
 * @version $Id: $Id
 */
package com.greenpepper.interpreter.flow.scenario;

import com.greenpepper.expectation.DuckExpectation;
public class Expectation
{
    private String expected;
    private Object actual;
    private String describe;

    /**
     * 

Constructor for Expectation.

*/ public Expectation() { } /** *

Constructor for Expectation.

* * @param expected a {@link java.lang.String} object. */ public Expectation(String expected) { this.expected = expected; } /** *

meets.

* * @return a boolean. */ public boolean meets() { DuckExpectation duck = DuckExpectation.create( getExpected() ); return duck.meets( actual ); } /** *

Getter for the field expected.

* * @return a {@link java.lang.String} object. */ public String getExpected() { return expected; } /** *

Getter for the field actual.

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

Setter for the field actual.

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

Getter for the field describe.

* * @return a {@link java.lang.String} object. */ public String getDescribe() { return describe == null ? String.format( "%s (and not %s)", getActual(), getExpected() ) : describe; } /** *

Setter for the field describe.

* * @param describe a {@link java.lang.String} object. */ public void setDescribe(String describe) { this.describe = describe; } /** {@inheritDoc} */ @Override public String toString() { return String.format( "Expectation: { expected: %s, actual: %s }", expected, actual ); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy