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

com.greenpepper.annotation.WrongAnnotation Maven / Gradle / Ivy

package com.greenpepper.annotation;

import static com.greenpepper.GreenPepper.$;
import com.greenpepper.Text;
import com.greenpepper.TypeConversion;
import com.greenpepper.expectation.Expectation;

/**
 * 

WrongAnnotation class.

* * @author oaouattara * @version $Id: $Id */ public class WrongAnnotation implements Annotation { private Expectation expected; private Object actual; private boolean detailed; /** {@inheritDoc} */ public void writeDown( Text text ) { text.setStyle( Styles.BACKGROUND_COLOR, Colors.RED ); text.setStatus( Status.FAILLURE ); if (detailed) text.setContent( message() ); } private String message() { StringBuilder message = new StringBuilder(); message.append( "" ).append( $( "expected" ) ).append( ": " ); expected.describeTo( message ); message.append( " " ).append( $( "received" ) ).append( ": " ).append( TypeConversion.toString( actual ) ); return message.toString(); } /** *

giveDetails.

* * @param expected a {@link com.greenpepper.expectation.Expectation} object. * @param actual a {@link java.lang.Object} object. */ public void giveDetails( Expectation expected, Object actual ) { this.expected = expected; this.actual = actual; this.detailed = true; } /** *

isDetailed.

* * @return a boolean. */ public boolean isDetailed() { return detailed; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy