org.assertj.core.api
Class BDDAssertions

java.lang.Object
  extended by org.assertj.core.api.Assertions
      extended by org.assertj.core.api.BDDAssertions

public class BDDAssertions
extends Assertions

BDD style entry point for assertion methods for different data types. Each method in this class is a static factory for the type-specific assertion objects. The purpose of this class is to make test code more readable.

The difference with Assertions class is that entry point methods are named then instead of assertThat.

For example:

 @Test
 public void bdd_assertions_examples() {

   //given
   List<BasketBallPlayer> bulls = new ArrayList<BasketBallPlayer>();

   //when
   bulls.add(rose);
   bulls.add(noah);

   then(bulls).contains(rose, noah).doesNotContain(james);
 }
 

Author:
Alex Ruiz, Yvonne Wang, David DIDIER, Ted Young, Joel Costigliola, Matthieu Baechler, Mikhail Mazursky, Nicolas François, Julien Meddah, William Delanoue, Mariusz Smykula

Constructor Summary
protected BDDAssertions()
          Creates a new BDDAssertions.
 
Method Summary
static AbstractBigDecimalAssert<?> then(BigDecimal actual)
          Creates a new instance of BigDecimalAssert.
static AbstractBooleanAssert<?> then(boolean actual)
          Creates a new instance of BooleanAssert.
static AbstractBooleanAssert<?> then(Boolean actual)
          Creates a new instance of BooleanAssert.
static AbstractBooleanArrayAssert<?> then(boolean[] actual)
          Creates a new instance of BooleanArrayAssert.
static AbstractByteAssert<?> then(byte actual)
          Creates a new instance of ByteAssert.
static AbstractByteAssert<?> then(Byte actual)
          Creates a new instance of ByteAssert.
static AbstractByteArrayAssert<?> then(byte[] actual)
          Creates a new instance of ByteArrayAssert.
static AbstractCharacterAssert<?> then(char actual)
          Creates a new instance of CharacterAssert.
static AbstractCharArrayAssert<?> then(char[] actual)
          Creates a new instance of CharArrayAssert.
static AbstractCharacterAssert<?> then(Character actual)
          Creates a new instance of CharacterAssert.
static AbstractCharSequenceAssert<?,? extends CharSequence> then(CharSequence actual)
          Creates a new instance of CharSequenceAssert.
static AbstractClassAssert<?> then(Class<?> actual)
          Creates a new instance of ClassAssert
static AbstractDateAssert<?> then(Date actual)
          Creates a new instance of DateAssert.
static AbstractDoubleAssert<?> then(double actual)
          Creates a new instance of DoubleAssert.
static AbstractDoubleAssert<?> then(Double actual)
          Creates a new instance of DoubleAssert.
static AbstractDoubleArrayAssert<?> then(double[] actual)
          Creates a new instance of DoubleArrayAssert.
static AbstractFileAssert<?> then(File actual)
          Creates a new instance of FileAssert.
static AbstractFloatAssert<?> then(float actual)
          Creates a new instance of FloatAssert.
static AbstractFloatAssert<?> then(Float actual)
          Creates a new instance of FloatAssert.
static AbstractFloatArrayAssert<?> then(float[] actual)
          Creates a new instance of FloatArrayAssert.
static AbstractInputStreamAssert<?,? extends InputStream> then(InputStream actual)
          Creates a new instance of InputStreamAssert.
static AbstractIntegerAssert<?> then(int actual)
          Creates a new instance of IntegerAssert.
static AbstractIntArrayAssert<?> then(int[] actual)
          Creates a new instance of IntArrayAssert.
static AbstractIntegerAssert<?> then(Integer actual)
          Creates a new instance of IntegerAssert.
static
<T> AbstractIterableAssert<?,? extends Iterable<? extends T>,T>
then(Iterable<? extends T> actual)
          Creates a new instance of IterableAssert.
static
<T> AbstractIterableAssert<?,? extends Iterable<? extends T>,T>
then(Iterator<? extends T> actual)
          Creates a new instance of IterableAssert.
static
<T> AbstractListAssert<?,? extends List<? extends T>,T>
then(List<? extends T> actual)
          Creates a new instance of ListAssert.
static AbstractLongAssert<?> then(long actual)
          Creates a new instance of LongAssert.
static AbstractLongAssert<?> then(Long actual)
          Creates a new instance of LongAssert.
static AbstractLongArrayAssert<?> then(long[] actual)
          Creates a new instance of LongArrayAssert.
static
<K,V> AbstractMapAssert<?,? extends Map<K,V>,K,V>
then(Map<K,V> actual)
          Creates a new instance of MapAssert.
static AbstractShortAssert<?> then(short actual)
          Creates a new instance of ShortAssert.
static AbstractShortAssert<?> then(Short actual)
          Creates a new instance of ShortAssert.
static AbstractShortArrayAssert<?> then(short[] actual)
          Creates a new instance of ShortArrayAssert.
static AbstractCharSequenceAssert<?,String> then(String actual)
          Creates a new instance of StringAssert.
static
<T> AbstractObjectAssert<?,T>
then(T actual)
          Creates a new instance of ObjectAssert.
static
<T> AbstractObjectArrayAssert<?,T>
then(T[] actual)
          Creates a new instance of ObjectArrayAssert.
static AbstractThrowableAssert<?,? extends Throwable> then(Throwable actual)
          Creates a new instance of ThrowableAssert.
 
Methods inherited from class org.assertj.core.api.Assertions
allOf, allOf, anyOf, anyOf, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, atIndex, contentOf, contentOf, contentOf, doesNotHave, entry, extractProperty, extractProperty, fail, fail, failBecauseExceptionWasNotThrown, filter, filter, linesOf, linesOf, linesOf, not, offset, offset, registerCustomDateFormat, registerCustomDateFormat, setAllowExtractingPrivateFields, setRemoveAssertJRelatedElementsFromStackTrace, tuple, useDateFormat, useDateFormat, useDefaultDateFormats, useDefaultDateFormatsOnly, useIsoDateFormat, useIsoDateTimeFormat, useIsoDateTimeWithMsFormat, within, within, within
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BDDAssertions

protected BDDAssertions()
Creates a new BDDAssertions.

Method Detail

then

public static AbstractBigDecimalAssert<?> then(BigDecimal actual)
Creates a new instance of BigDecimalAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractBooleanAssert<?> then(boolean actual)
Creates a new instance of BooleanAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractBooleanAssert<?> then(Boolean actual)
Creates a new instance of BooleanAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractBooleanArrayAssert<?> then(boolean[] actual)
Creates a new instance of BooleanArrayAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractByteAssert<?> then(byte actual)
Creates a new instance of ByteAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractByteAssert<?> then(Byte actual)
Creates a new instance of ByteAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractByteArrayAssert<?> then(byte[] actual)
Creates a new instance of ByteArrayAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractCharacterAssert<?> then(char actual)
Creates a new instance of CharacterAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractCharArrayAssert<?> then(char[] actual)
Creates a new instance of CharArrayAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractCharacterAssert<?> then(Character actual)
Creates a new instance of CharacterAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractClassAssert<?> then(Class<?> actual)
Creates a new instance of ClassAssert

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static <T> AbstractIterableAssert<?,? extends Iterable<? extends T>,T> then(Iterable<? extends T> actual)
Creates a new instance of IterableAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static <T> AbstractIterableAssert<?,? extends Iterable<? extends T>,T> then(Iterator<? extends T> actual)
Creates a new instance of IterableAssert. The Iterator is first converted into an Iterable

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractDoubleAssert<?> then(double actual)
Creates a new instance of DoubleAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractDoubleAssert<?> then(Double actual)
Creates a new instance of DoubleAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractDoubleArrayAssert<?> then(double[] actual)
Creates a new instance of DoubleArrayAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractFileAssert<?> then(File actual)
Creates a new instance of FileAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractInputStreamAssert<?,? extends InputStream> then(InputStream actual)
Creates a new instance of InputStreamAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractFloatAssert<?> then(float actual)
Creates a new instance of FloatAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractFloatAssert<?> then(Float actual)
Creates a new instance of FloatAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractFloatArrayAssert<?> then(float[] actual)
Creates a new instance of FloatArrayAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractIntegerAssert<?> then(int actual)
Creates a new instance of IntegerAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractIntArrayAssert<?> then(int[] actual)
Creates a new instance of IntArrayAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractIntegerAssert<?> then(Integer actual)
Creates a new instance of IntegerAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static <T> AbstractListAssert<?,? extends List<? extends T>,T> then(List<? extends T> actual)
Creates a new instance of ListAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractLongAssert<?> then(long actual)
Creates a new instance of LongAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractLongAssert<?> then(Long actual)
Creates a new instance of LongAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractLongArrayAssert<?> then(long[] actual)
Creates a new instance of LongArrayAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static <T> AbstractObjectAssert<?,T> then(T actual)
Creates a new instance of ObjectAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static <T> AbstractObjectArrayAssert<?,T> then(T[] actual)
Creates a new instance of ObjectArrayAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static <K,V> AbstractMapAssert<?,? extends Map<K,V>,K,V> then(Map<K,V> actual)
Creates a new instance of MapAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractShortAssert<?> then(short actual)
Creates a new instance of ShortAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractShortAssert<?> then(Short actual)
Creates a new instance of ShortAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractShortArrayAssert<?> then(short[] actual)
Creates a new instance of ShortArrayAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractCharSequenceAssert<?,? extends CharSequence> then(CharSequence actual)
Creates a new instance of CharSequenceAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractCharSequenceAssert<?,String> then(String actual)
Creates a new instance of StringAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractDateAssert<?> then(Date actual)
Creates a new instance of DateAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion object.

then

public static AbstractThrowableAssert<?,? extends Throwable> then(Throwable actual)
Creates a new instance of ThrowableAssert.

Parameters:
actual - the actual value.
Returns:
the created assertion Throwable.


Copyright © 2013–2015 AssertJ. All rights reserved.