org.junit.contrib.truth.subjects
Class Subject<S extends Subject<S,T>,T>

java.lang.Object
  extended by org.junit.contrib.truth.subjects.Subject<S,T>
Direct Known Subclasses:
BooleanSubject, DefaultSubject, IntegerSubject, IterableSubject, StringSubject

@GwtCompatible(emulated=true)
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)

Nested Class Summary
static interface Subject.And<C>
          A convenience class to allow for chaining in the fluent API style, such that subjects can make propositions in series.
 
Constructor Summary
Subject(FailureStrategy failureStrategy, T subject)
           
 
Method Summary
protected  TestVerb check()
           
protected  void fail(String verb, Object... messageParts)
           
protected  void failWithoutSubject(String verb)
           
protected  T getSubject()
           
 Subject.And<S> is(T other)
           
 Subject.And<S> isA(Class<?> clazz)
           
 Subject.And<S> isEqualTo(Object other)
           
 Subject.And<S> isNotA(Class<?> clazz)
           
 Subject.And<S> isNotEqualTo(Object other)
           
 Subject.And<S> isNotNull()
           
 Subject.And<S> isNull()
           
protected  Subject.And<S> nextChain()
          A method which wraps the current Subject concrete subtype in a chaining "And" object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Subject

public Subject(FailureStrategy failureStrategy,
               T subject)
Method Detail

nextChain

protected final Subject.And<S> nextChain()
A method which wraps the current Subject concrete subtype in a chaining "And" object.


is

public Subject.And<S> is(T other)

isNull

public Subject.And<S> isNull()

isNotNull

public Subject.And<S> isNotNull()

isEqualTo

public Subject.And<S> isEqualTo(Object other)

isNotEqualTo

public Subject.And<S> isNotEqualTo(Object other)

isA

@GwtIncompatible(value="Class.isInstance")
public Subject.And<S> isA(Class<?> clazz)

isNotA

@GwtIncompatible(value="Class.isInstance")
public Subject.And<S> isNotA(Class<?> clazz)

getSubject

protected T getSubject()

check

protected TestVerb check()

fail

protected void fail(String verb,
                    Object... messageParts)

failWithoutSubject

protected void failWithoutSubject(String verb)


Copyright © 2014. All Rights Reserved.