Top Description Fields Constructors Methods
org.assertj.core.api

public abstract Class AbstractEnumerableAssert<SELF extends AbstractEnumerableAssert<SELF, ACTUAL, ELEMENT>, ACTUAL, ELEMENT>

extends AbstractAssert<SELF extends AbstractEnumerableAssert<SELF, ACTUAL, ELEMENT>, ACTUAL>
implements EnumerableAssert<AbstractEnumerableAssert<SELF extends AbstractEnumerableAssert<SELF, ACTUAL, ELEMENT>, ACTUAL, ELEMENT>, ELEMENT>
Class Inheritance
All Implemented Interfaces
org.assertj.core.api.EnumerableAssert
Known Direct Subclasses
org.assertj.core.api.AtomicIntegerArrayAssert, org.assertj.core.api.AtomicLongArrayAssert, org.assertj.core.api.AbstractArrayAssert
Type Parameters
<SELF>
the "self" type of this assertion class.
<ACTUAL>
the type of the "actual" value which is an Array of ELEMENT.
<ELEMENT>
the type of the "actual" array element.
Static Imports
org.assertj.core.internal.Arrays.assertIsArray

Base implementation for Enumerable class assertions.
Author
Joel Costigliola

Field Summary

Inherited from org.assertj.core.api.AbstractAssert:
actualassertionErrorCreatorconditionscustomRepresentationinfomyselfobjectsprintAssertionsDescriptionthrowUnsupportedExceptionOnEquals

Constructor Summary

AccessConstructor and Description
protected
AbstractEnumerableAssert(final ACTUAL actual, final Class<?> selfType)

Method Summary

Modifier and TypeMethod and Description
public SELF
hasSameSizeAs(Object
the array to compare size with actual group.
other
)

Implements org.assertj.core.api.EnumerableAssert.hasSameSizeAs.

Verifies that the actual group has the same size as given array.
public SELF
inBinary()

Overrides org.assertj.core.api.AbstractAssert.inBinary.

Use binary object representation instead of standard representation in error messages.
public SELF

Returns:

this assertion object.
inHexadecimal
()

Overrides org.assertj.core.api.AbstractAssert.inHexadecimal.

Enable hexadecimal object representation of Iterable elements instead of standard java representation in error messages.
Inherited from org.assertj.core.api.AbstractAssert:
areEqualasInstanceOfasListassertionErrorasStringdescribedAsdescriptionTextdoesNotHavedoesNotHaveSameClassAsdoesNotHaveSameHashCodeAsdoesNotHaveToStringdoesNotHaveToStringequalsextractingextractingfailurefailureWithActualExpectedfailWithActualExpectedAndMessagefailWithMessagegetWritableAssertionInfohashashCodehasSameClassAshasSameHashCodeAshasToStringhasToStringisisElementOfCustomAssertisEqualToisExactlyInstanceOfisInisInisInstanceOfisInstanceOfAnyisInstanceOfSatisfyingisNotisNotEqualToisNotExactlyInstanceOfisNotInisNotInisNotInstanceOfisNotInstanceOfAnyisNotNullisNotOfAnyClassInisNotSameAsisNullisOfAnyClassInisSameAsmatchesmatchesnewListAssertInstanceoverridingErrorMessageoverridingErrorMessagesatisfiessatisfiessatisfiessatisfiesAnyOfsatisfiesAnyOfsatisfiesAnyOfForProxysatisfiesForProxysetCustomRepresentationsetDescriptionConsumersetPrintAssertionsDescriptionthrowAssertionErrorusingComparatorusingComparatorusingDefaultComparatorusingRecursiveAssertionusingRecursiveAssertionusingRecursiveComparisonusingRecursiveComparisonwithAssertionStatewithFailMessagewithFailMessagewithRepresentationwithThreadDumpOnError

Constructor Detail

AbstractEnumerableAssertback to summary
protected AbstractEnumerableAssert(final ACTUAL actual, final Class<?> selfType)

Method Detail

hasSameSizeAsback to summary
public SELF hasSameSizeAs(Object other)

Implements org.assertj.core.api.EnumerableAssert.hasSameSizeAs.

Doc from org.assertj.core.api.EnumerableAssert.hasSameSizeAs.

Verifies that the actual group has the same size as given array.

Parameter is declared as Object to accept both Object[] and primitive arrays (e.g. int[]).

Example:
 int[] oneTwoThree = {1, 2, 3};
Iterable<Ring> elvesRings = newArrayList(vilya, nenya, narya);

// assertion will pass
assertThat(elvesRings).hasSameSizeAs(oneTwoThree);

// assertions will fail
assertThat(elvesRings).hasSameSizeAs(new int[] { 1, 2});
assertThat(elvesRings).hasSameSizeAs(new int[] { 1, 2, 3, 4});

Example with byte array:

 // assertions will pass
assertThat(new byte[]{1, 2}).hasSameSizeAs(new byte[]{2, 3});
assertThat(new byte[]{1, 2}).hasSameSizeAs(new Byte[]{2, 3});
assertThat(new byte[]{1, 2}).hasSameSizeAs(new int[]{2, 3});
assertThat(new byte[]{1, 2}).hasSameSizeAs(new String[]{"1", "2"});

// assertion will fail
assertThat(new byte[]{ 1, 2 }).hasSameSizeAs(new byte[]{ 1, 2, 3 });
Parameters
other:Object

the array to compare size with actual group.

Returns:SELF

this assertion object.

Annotations
@Override
inBinaryback to summary
public SELF inBinary()

Overrides org.assertj.core.api.AbstractAssert.inBinary.

Doc from org.assertj.core.api.AbstractAssert.inBinary.

Use binary object representation instead of standard representation in error messages.

Example:

 assertThat(1).inBinary().isEqualTo(2);

org.junit.ComparisonFailure:
Expected :0b00000000_00000000_00000000_00000010
Actual   :0b00000000_00000000_00000000_00000001
Returns:SELF

this assertion object.

Annotations
@Override
@CheckReturnValue
inHexadecimalback to summary
public SELF inHexadecimal()

Overrides org.assertj.core.api.AbstractAssert.inHexadecimal.

Enable hexadecimal object representation of Iterable elements instead of standard java representation in error messages.

It can be useful to better understand what the error was with a more meaningful error message.

Example

 assertThat(new byte[]{0x10,0x20}).inHexadecimal().contains(new byte[]{0x30});
With standard error message:
 Expecting:
 <[16, 32]>
to contain:
 <[48]>
but could not find:
 <[48]>
With Hexadecimal error message:
 Expecting:
 <[0x10, 0x20]>
to contain:
 <[0x30]>
but could not find:
 <[0x30]>
Returns:SELF

this assertion object.

Annotations
@Override
@CheckReturnValue