org.truth0.subjects
Class Subject<S extends Subject<S,T>,T>

java.lang.Object
  extended by org.truth0.subjects.Subject<S,T>
Direct Known Subclasses:
BooleanSubject, ClassSubject, DefaultSubject, IntegerSubject, IterableSubject, MapSubject, StringSubject

public class Subject<S extends Subject<S,T>,T>
extends Object

Propositions for arbitrarily typed subjects and for properties of Object

Author:
David Saff, Christian Gruber (cgruber@israfil.net)

Field Summary
protected  FailureStrategy failureStrategy
           
 
Constructor Summary
Subject(FailureStrategy failureStrategy, T subject)
           
 
Method Summary
protected  TestVerb check()
           
protected  void fail(String verb, Object... messageParts)
          Assembles a failure message and passes such to the FailureStrategy
protected  void failWithBadResults(String verb, Object expected, String failVerb, Object actual)
          Assembles a failure message and passes such to the FailureStrategy
protected  void failWithoutSubject(String verb)
           
protected  T getSubject()
           
 void is(T other)
           
 void isEqualTo(Object other)
           
 void isNotEqualTo(Object other)
           
 void isNotNull()
           
 void isNull()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

failureStrategy

protected final FailureStrategy failureStrategy
Constructor Detail

Subject

public Subject(FailureStrategy failureStrategy,
               T subject)
Method Detail

is

public void is(T other)

isNull

public void isNull()

isNotNull

public void isNotNull()

isEqualTo

public void isEqualTo(Object other)

isNotEqualTo

public void isNotEqualTo(Object other)

getSubject

protected T getSubject()

check

protected TestVerb check()

fail

protected void fail(String verb,
                    Object... messageParts)
Assembles a failure message and passes such to the FailureStrategy

Parameters:
verb - the act being asserted
messageParts - the expectations against which the subject is compared

failWithBadResults

protected void failWithBadResults(String verb,
                                  Object expected,
                                  String failVerb,
                                  Object actual)
Assembles a failure message and passes such to the FailureStrategy

Parameters:
verb - the act being asserted
messageParts - the expectations against which the subject is compared

failWithoutSubject

protected void failWithoutSubject(String verb)


Copyright © 2013. All Rights Reserved.