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

public Class ShouldContainExactly

extends BasicErrorMessageFactory
Class Inheritance
Static Imports
java.lang.String.format, org.assertj.core.util.IterableUtil.isNullOrEmpty, .Strings.escapePercent

Creates an error message indicating that an assertion that verifies a group of elements contains exactly a given set of values and nothing else failed, exactly meaning same elements in same order. A group of elements can be a collection, an array or a String.
Authors
Joel Costigliola, Yanming Zhou

Field Summary

Inherited from org.assertj.core.error.BasicErrorMessageFactory:
argumentsformatformatter

Constructor Summary

AccessConstructor and Description
private
ShouldContainExactly(Object actual, Object expected, ComparisonStrategy comparisonStrategy)

private
ShouldContainExactly(Object actual, Object expected, Object notFound, Object notExpected, ComparisonStrategy comparisonStrategy)

private
ShouldContainExactly(Object actual, Object expected, Object notFound, ComparisonStrategy comparisonStrategy)

private
ShouldContainExactly(Object actual, Object expected, ComparisonStrategy comparisonStrategy, Object unexpected)

private
ShouldContainExactly(Object actual, Object expected, List<IndexedDiff> indexDiffs, ComparisonStrategy comparisonStrategy)

private
ShouldContainExactly(Object actualElement, Object expectedElement, int indexOfDifferentElements, ComparisonStrategy comparisonStrategy)

Method Summary

Modifier and TypeMethod and Description
public static ErrorMessageFactory

Returns:

the created ErrorMessageFactory.
elementsDifferAtIndex
(Object
the actual element at indexOfDifferentElements index.
actualElement
,
Object
the expected element at indexOfDifferentElements index.
expectedElement
,
int
index where actual and expect differs.
indexOfDifferentElements
,
ComparisonStrategy
the ComparisonStrategy used to evaluate assertion.
comparisonStrategy
)

Creates a new ShouldContainExactly for the case where actual and expected have the same elements in different order according to the given ComparisonStrategy.

public static ErrorMessageFactory

Returns:

the created ErrorMessageFactory.
elementsDifferAtIndex
(Object
the actual element at indexOfDifferentElements index.
actualElement
,
Object
the expected element at indexOfDifferentElements index.
expectedElement
,
int
index where actual and expect differs.
indexOfDifferentElements
)

Creates a new ShouldContainExactly for the case where actual and expected have the same elements in different order.

private static String
public static ErrorMessageFactory

Returns:

the created ErrorMessageFactory.
shouldContainExactly
(Object
the actual value in the failed assertion.
actual
,
Iterable<?>
values expected to be contained in actual.
expected
,
Iterable<?>
values in expected not found in actual.
notFound
,
Iterable<?>
values in actual that were not in expected.
notExpected
,
ComparisonStrategy
the ComparisonStrategy used to evaluate assertion.
comparisonStrategy
)

Creates a new ShouldContainExactly.

public static ErrorMessageFactory

Returns:

the created ErrorMessageFactory.
shouldContainExactly
(Object
the actual value in the failed assertion.
actual
,
Iterable<?>
values expected to be contained in actual.
expected
,
Iterable<?>
values in expected not found in actual.
notFound
,
Iterable<?>
values in actual that were not in expected.
notExpected
)

Creates a new ShouldContainExactly.

public static ErrorMessageFactory

Returns:

the created ErrorMessageFactory.
shouldContainExactlyWithIndexes
(Object
the actual value in the failed assertion.
actual
,
Iterable<?>
values expected to be contained in actual.
expected
,
List<IndexedDiff>
the IndexedDiff the actual and expected differ at.
indexDifferences
,
ComparisonStrategy
the ComparisonStrategy used to evaluate assertion.
comparisonStrategy
)

Creates a new ShouldContainExactly.

public static ErrorMessageFactory

Returns:

the created ErrorMessageFactory.
shouldContainExactlyWithIndexes
(Object
the actual value in the failed assertion.
actual
,
Iterable<?>
values expected to be contained in actual.
expected
,
List<IndexedDiff>
the IndexedDiff the actual and expected differ at.
indexDifferences
)

Creates a new ShouldContainExactly.

Inherited from org.assertj.core.error.BasicErrorMessageFactory:
createcreatecreateequalshashCodetoStringunquotedString

Constructor Detail

ShouldContainExactlyback to summary
private ShouldContainExactly(Object actual, Object expected, ComparisonStrategy comparisonStrategy)
ShouldContainExactlyback to summary
private ShouldContainExactly(Object actual, Object expected, Object notFound, Object notExpected, ComparisonStrategy comparisonStrategy)
ShouldContainExactlyback to summary
private ShouldContainExactly(Object actual, Object expected, Object notFound, ComparisonStrategy comparisonStrategy)
ShouldContainExactlyback to summary
private ShouldContainExactly(Object actual, Object expected, ComparisonStrategy comparisonStrategy, Object unexpected)
ShouldContainExactlyback to summary
private ShouldContainExactly(Object actual, Object expected, List<IndexedDiff> indexDiffs, ComparisonStrategy comparisonStrategy)
ShouldContainExactlyback to summary
private ShouldContainExactly(Object actualElement, Object expectedElement, int indexOfDifferentElements, ComparisonStrategy comparisonStrategy)

Method Detail

elementsDifferAtIndexback to summary
public static ErrorMessageFactory elementsDifferAtIndex(Object actualElement, Object expectedElement, int indexOfDifferentElements, ComparisonStrategy comparisonStrategy)

Creates a new ShouldContainExactly for the case where actual and expected have the same elements in different order according to the given ComparisonStrategy.

Parameters
actualElement:Object

the actual element at indexOfDifferentElements index.

expectedElement:Object

the expected element at indexOfDifferentElements index.

indexOfDifferentElements:int

index where actual and expect differs.

comparisonStrategy:ComparisonStrategy

the ComparisonStrategy used to evaluate assertion.

Returns:ErrorMessageFactory

the created ErrorMessageFactory.

elementsDifferAtIndexback to summary
public static ErrorMessageFactory elementsDifferAtIndex(Object actualElement, Object expectedElement, int indexOfDifferentElements)

Creates a new ShouldContainExactly for the case where actual and expected have the same elements in different order.

Parameters
actualElement:Object

the actual element at indexOfDifferentElements index.

expectedElement:Object

the expected element at indexOfDifferentElements index.

indexOfDifferentElements:int

index where actual and expect differs.

Returns:ErrorMessageFactory

the created ErrorMessageFactory.

formatIndexDifferencesback to summary
private static String formatIndexDifferences(List<IndexedDiff> indexedDiffs)
shouldContainExactlyback to summary
public static ErrorMessageFactory shouldContainExactly(Object actual, Iterable<?> expected, Iterable<?> notFound, Iterable<?> notExpected, ComparisonStrategy comparisonStrategy)

Creates a new ShouldContainExactly.

Parameters
actual:Object

the actual value in the failed assertion.

expected:Iterable<?>

values expected to be contained in actual.

notFound:Iterable<?>

values in expected not found in actual.

notExpected:Iterable<?>

values in actual that were not in expected.

comparisonStrategy:ComparisonStrategy

the ComparisonStrategy used to evaluate assertion.

Returns:ErrorMessageFactory

the created ErrorMessageFactory.

shouldContainExactlyback to summary
public static ErrorMessageFactory shouldContainExactly(Object actual, Iterable<?> expected, Iterable<?> notFound, Iterable<?> notExpected)

Creates a new ShouldContainExactly.

Parameters
actual:Object

the actual value in the failed assertion.

expected:Iterable<?>

values expected to be contained in actual.

notFound:Iterable<?>

values in expected not found in actual.

notExpected:Iterable<?>

values in actual that were not in expected.

Returns:ErrorMessageFactory

the created ErrorMessageFactory.

shouldContainExactlyWithIndexesback to summary
public static ErrorMessageFactory shouldContainExactlyWithIndexes(Object actual, Iterable<?> expected, List<IndexedDiff> indexDifferences, ComparisonStrategy comparisonStrategy)

Creates a new ShouldContainExactly.

Parameters
actual:Object

the actual value in the failed assertion.

expected:Iterable<?>

values expected to be contained in actual.

indexDifferences:List<IndexedDiff>

the IndexedDiff the actual and expected differ at.

comparisonStrategy:ComparisonStrategy

the ComparisonStrategy used to evaluate assertion.

Returns:ErrorMessageFactory

the created ErrorMessageFactory.

shouldContainExactlyWithIndexesback to summary
public static ErrorMessageFactory shouldContainExactlyWithIndexes(Object actual, Iterable<?> expected, List<IndexedDiff> indexDifferences)

Creates a new ShouldContainExactly.

Parameters
actual:Object

the actual value in the failed assertion.

expected:Iterable<?>

values expected to be contained in actual.

indexDifferences:List<IndexedDiff>

the IndexedDiff the actual and expected differ at.

Returns:ErrorMessageFactory

the created ErrorMessageFactory.