Package org.assertj.core.api
Class AtomicLongArrayAssert
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
-
- org.assertj.core.api.AbstractEnumerableAssert<AtomicLongArrayAssert,AtomicLongArray,Long>
-
- org.assertj.core.api.AtomicLongArrayAssert
-
- All Implemented Interfaces:
Assert<AtomicLongArrayAssert,AtomicLongArray>
,Descriptable<AtomicLongArrayAssert>
,EnumerableAssert<AbstractEnumerableAssert<AtomicLongArrayAssert,AtomicLongArray,Long>,Long>
,ExtensionPoints<AtomicLongArrayAssert,AtomicLongArray>
public class AtomicLongArrayAssert extends AbstractEnumerableAssert<AtomicLongArrayAssert,AtomicLongArray,Long>
-
-
Field Summary
Fields Modifier and Type Field Description private long[]
array
protected LongArrays
arrays
-
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, assertionErrorCreator, conditions, info, myself, objects, throwUnsupportedExceptionOnEquals
-
-
Constructor Summary
Constructors Constructor Description AtomicLongArrayAssert(AtomicLongArray actual)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicLongArrayAssert
contains(long... values)
Verifies that the actualAtomicLongArray
contains the given values, in any order.AtomicLongArrayAssert
contains(long value, Index index)
Verifies that the actual atomic array contains the given value at the given index.AtomicLongArrayAssert
containsAnyOf(long... values)
Verifies that the actual array contains at least one of the given values.AtomicLongArrayAssert
containsExactly(long... values)
Verifies that the actual AtomicLongArray contains only the given values and nothing else, in order.AtomicLongArrayAssert
containsExactlyInAnyOrder(long... values)
Verifies that the actual AtomicLongArray contains exactly the given values and nothing else, in any order.AtomicLongArrayAssert
containsOnly(long... values)
Verifies that the actual atomic array contains only the given values and nothing else, in any order.AtomicLongArrayAssert
containsOnlyOnce(long... values)
Verifies that the actual atomic array contains the given values only once.AtomicLongArrayAssert
containsSequence(long... sequence)
Verifies that the actual atomic array contains the given sequence, without any other values between them.AtomicLongArrayAssert
containsSubsequence(long... subsequence)
Verifies that the actual atomic array contains the given subsequence (possibly with other values between them).AtomicLongArrayAssert
doesNotContain(long... values)
Verifies that the actual atomic array does not contain the given values.AtomicLongArrayAssert
doesNotContain(long value, Index index)
Verifies that the actual atomic array does not contain the given value at the given index.AtomicLongArrayAssert
doesNotHaveDuplicates()
Verifies that the actual atomic array does not contain duplicates.AtomicLongArrayAssert
endsWith(long... sequence)
Verifies that the actual atomic array ends with the given sequence of values, without any other values between them.AtomicLongArrayAssert
hasArray(long[] expected)
Verifies that the AtomicLongArray has the given array.AtomicLongArrayAssert
hasSameSizeAs(Iterable<?> other)
Verifies that the AtomicLongArray has the same size as givenIterable
.AtomicLongArrayAssert
hasSize(int expected)
Verifies that the number of values in the AtomicLongArray is equal to the given one.AtomicLongArrayAssert
hasSizeBetween(int lowerBoundary, int higherBoundary)
Verifies that the number of values in the actual array is between the given boundaries (inclusive).AtomicLongArrayAssert
hasSizeGreaterThan(int boundary)
Verifies that the number of values in the actual array is greater than the given boundary.AtomicLongArrayAssert
hasSizeGreaterThanOrEqualTo(int boundary)
Verifies that the number of values in the actual array is greater than or equal to the given boundary.AtomicLongArrayAssert
hasSizeLessThan(int boundary)
Verifies that the number of values in the actual array is less than the given boundary.AtomicLongArrayAssert
hasSizeLessThanOrEqualTo(int boundary)
Verifies that the number of values in the actual array is less than or equal to the given boundary.void
isEmpty()
Verifies that the AtomicLongArray is empty.AtomicLongArrayAssert
isNotEmpty()
Verifies that the AtomicLongArray is not empty.void
isNullOrEmpty()
Verifies that the AtomicLongArray isnull
or empty.AtomicLongArrayAssert
isSorted()
Verifies that the actual AtomicLongArray is sorted in ascending order according to the natural ordering of its elements.AtomicLongArrayAssert
isSortedAccordingTo(Comparator<? super Long> comparator)
Verifies that the actual AtomicLongArray is sorted according to the given comparator.
Empty arrays are considered sorted whatever the comparator is.
One element arrays are considered sorted if the element is compatible with comparator, otherwise an AssertionError is thrown.AtomicLongArrayAssert
startsWith(long... sequence)
Verifies that the actual atomic array starts with the given sequence of values, without any other values between them.AtomicLongArrayAssert
usingDefaultElementComparator()
Revert to standard comparison for incoming assertion group element checks.AtomicLongArrayAssert
usingElementComparator(Comparator<? super Long> customComparator)
Use given custom comparator instead of relying on Longequals
method to compare elements for incoming assertion checks.-
Methods inherited from class org.assertj.core.api.AbstractEnumerableAssert
hasSameSizeAs, inBinary, inHexadecimal
-
Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, asInstanceOf, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withAssertionState, withFailMessage, withRepresentation, withThreadDumpOnError
-
-
-
-
Field Detail
-
arrays
protected LongArrays arrays
-
array
private long[] array
-
-
Constructor Detail
-
AtomicLongArrayAssert
public AtomicLongArrayAssert(AtomicLongArray actual)
-
-
Method Detail
-
isNullOrEmpty
public void isNullOrEmpty()
Verifies that the AtomicLongArray isnull
or empty.Example:
// assertions will pass assertThat(new AtomicLongArray(new long[0])).isNullOrEmpty(); AtomicLongArray array = null; assertThat(array).isNullOrEmpty(); // assertion will fail assertThat(new AtomicLongArray(new long[] { 1, 2, 3 })).isNullOrEmpty();
- Throws:
AssertionError
- if the AtomicLongArray is notnull
or not empty.- Since:
- 2.7.0 / 3.7.0
-
isEmpty
public void isEmpty()
Verifies that the AtomicLongArray is empty.Example:
// assertion will pass assertThat(new AtomicLongArray(new long[0])).isEmpty(); // assertion will fail assertThat(new AtomicLongArray(new long[] { 1, 2, 3 })).isEmpty();
- Throws:
AssertionError
- if the AtomicLongArray is not empty.- Since:
- 2.7.0 / 3.7.0
-
isNotEmpty
public AtomicLongArrayAssert isNotEmpty()
Verifies that the AtomicLongArray is not empty.Example:
// assertion will pass assertThat(new AtomicLongArray(new long[] { 1, 2, 3 })).isNotEmpty(); // assertion will fail assertThat(new AtomicLongArray(new long[0])).isNotEmpty();
- Returns:
this
assertion object.- Throws:
AssertionError
- if the AtomicLongArray is empty.- Since:
- 2.7.0 / 3.7.0
-
hasArray
public AtomicLongArrayAssert hasArray(long[] expected)
Verifies that the AtomicLongArray has the given array.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).hasArray(new long[] { 1, 2, 3 }); // assertion will fail assertThat(atomicLongArray).hasArray(new long[] { 2, 3, 4 });
- Parameters:
expected
- the long[] array expected to be in the actual AtomicLongArray.- Returns:
this
assertion object.- Throws:
AssertionError
- if the AtomicLongArray does not have the given array.- Since:
- 2.7.0 / 3.7.0
-
hasSize
public AtomicLongArrayAssert hasSize(int expected)
Verifies that the number of values in the AtomicLongArray is equal to the given one.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); assertThat(atomicLongArray).hasSize(3); // assertion will fail assertThat(atomicLongArray).hasSize(1);
- Parameters:
expected
- the expected number of values in the actual AtomicLongArray.- Returns:
this
assertion object.- Throws:
AssertionError
- if the number of values of the AtomicLongArray is not equal to the given one.- Since:
- 2.7.0 / 3.7.0
-
hasSizeGreaterThan
public AtomicLongArrayAssert hasSizeGreaterThan(int boundary)
Verifies that the number of values in the actual array is greater than the given boundary.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).hasSizeGreaterThan(1); // assertion will fail assertThat(atomicLongArray).hasSizeGreaterThan(3);
- Parameters:
boundary
- the given value to compare the actual size to.- Returns:
this
assertion object.- Throws:
AssertionError
- if the number of values of the actual array is not greater than the boundary.- Since:
- 3.12.0
-
hasSizeGreaterThanOrEqualTo
public AtomicLongArrayAssert hasSizeGreaterThanOrEqualTo(int boundary)
Verifies that the number of values in the actual array is greater than or equal to the given boundary.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).hasSizeGreaterThanOrEqualTo(3); // assertion will fail assertThat(atomicLongArray).hasSizeGreaterThanOrEqualTo(5);
- Parameters:
boundary
- the given value to compare the actual size to.- Returns:
this
assertion object.- Throws:
AssertionError
- if the number of values of the actual array is not greater than or equal to the boundary.- Since:
- 3.12.0
-
hasSizeLessThan
public AtomicLongArrayAssert hasSizeLessThan(int boundary)
Verifies that the number of values in the actual array is less than the given boundary.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).hasSizeLessThan(4); // assertion will fail assertThat(atomicLongArray).hasSizeLessThan(2);
- Parameters:
boundary
- the given value to compare the actual size to.- Returns:
this
assertion object.- Throws:
AssertionError
- if the number of values of the actual array is not less than the boundary.- Since:
- 3.12.0
-
hasSizeLessThanOrEqualTo
public AtomicLongArrayAssert hasSizeLessThanOrEqualTo(int boundary)
Verifies that the number of values in the actual array is less than or equal to the given boundary.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).hasSizeLessThanOrEqualTo(3); // assertion will fail assertThat(atomicLongArray).hasSizeLessThanOrEqualTo(2);
- Parameters:
boundary
- the given value to compare the actual size to.- Returns:
this
assertion object.- Throws:
AssertionError
- if the number of values of the actual array is not less than or equal to the boundary.- Since:
- 3.12.0
-
hasSizeBetween
public AtomicLongArrayAssert hasSizeBetween(int lowerBoundary, int higherBoundary)
Verifies that the number of values in the actual array is between the given boundaries (inclusive).Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).hasSizeBetween(3, 4); // assertion will fail assertThat(atomicLongArray).hasSizeBetween(4, 6);
- Parameters:
lowerBoundary
- the lower boundary compared to which actual size should be greater than or equal to.higherBoundary
- the higher boundary compared to which actual size should be less than or equal to.- Returns:
this
assertion object.- Throws:
AssertionError
- if the number of values of the actual array is not between the boundaries.- Since:
- 3.12.0
-
hasSameSizeAs
public AtomicLongArrayAssert hasSameSizeAs(Iterable<?> other)
Verifies that the AtomicLongArray has the same size as givenIterable
.Example:
Iterable<String> abc = newArrayList("a", "b", "c"); AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).hasSameSizeAs(abc); // assertions will fail assertThat(atomicLongArray).hasSameSizeAs(Arrays.asList(1, 2)); assertThat(atomicLongArray).hasSameSizeAs(Arrays.asList(1, 2, 3, 4));
- Parameters:
other
- theIterable
to compare size with actual AtomicLongArray.- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual AtomicLongArray isnull
.AssertionError
- if the otherIterable
isnull
.AssertionError
- if actual AtomicLongArray and givenIterable
don't have the same size.- Since:
- 2.7.0 / 3.7.0
-
contains
public AtomicLongArrayAssert contains(long... values)
Verifies that the actualAtomicLongArray
contains the given values, in any order.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertions will pass assertThat(atomicLongArray).contains(1, 2) .contains(3, 1) .contains(1, 3, 2); // assertions will fail assertThat(atomicLongArray).contains(2, 3, 4); assertThat(atomicLongArray).contains(4, 5, 6);
- Parameters:
values
- the given values.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the given argument isnull
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual atomic array isnull
.AssertionError
- if the actual atomic array does not contain the given values.- Since:
- 2.7.0 / 3.7.0
-
containsOnly
public AtomicLongArrayAssert containsOnly(long... values)
Verifies that the actual atomic array contains only the given values and nothing else, in any order.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertions will pass assertThat(atomicLongArray).containsOnly(1, 2, 3) .containsOnly(2, 3, 1); assertThat(new AtomicLongArray(new long[] { 1, 1, 2 })).containsOnly(1, 2); // assertions will fail assertThat(atomicLongArray).containsOnly(1, 2, 3, 4); assertThat(atomicLongArray).containsOnly(4, 7);
- Parameters:
values
- the given values.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the given argument isnull
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual atomic array isnull
.AssertionError
- if the actual atomic array does not contain the given values, i.e. it contains a subset of of the given values, or more values than the given ones.- Since:
- 2.7.0 / 3.7.0
-
containsOnlyOnce
public AtomicLongArrayAssert containsOnlyOnce(long... values)
Verifies that the actual atomic array contains the given values only once.Examples :
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).containsOnlyOnce(1, 2); // assertions will fail assertThat(atomicLongArray).containsOnlyOnce(4); assertThat(new AtomicLongArray(new long[] { 1, 2, 1 })).containsOnlyOnce(1); assertThat(new AtomicLongArray(new long[] { 1, 2, 3, 3 })).containsOnlyOnce(1, 2, 3);
- Parameters:
values
- the given values.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the given argument isnull
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual atomic array isnull
.AssertionError
- if the actual AtomicLongArray does not contain the given values or contains them more than once.- Since:
- 2.7.0 / 3.7.0
-
containsSequence
public AtomicLongArrayAssert containsSequence(long... sequence)
Verifies that the actual atomic array contains the given sequence, without any other values between them.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).containsSequence(1, 2); // assertion will fail assertThat(atomicLongArray).containsSequence(1, 3); assertThat(atomicLongArray).containsSequence(2, 1);
- Parameters:
sequence
- the sequence of values to look for.- Returns:
- myself assertion object.
- Throws:
AssertionError
- if the actual atomic array isnull
.AssertionError
- if the given array isnull
.AssertionError
- if the actual atomic array does not contain the given sequence.- Since:
- 2.7.0 / 3.7.0
-
containsSubsequence
public AtomicLongArrayAssert containsSubsequence(long... subsequence)
Verifies that the actual atomic array contains the given subsequence (possibly with other values between them).Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertions will pass assertThat(atomicLongArray).containsSubsequence(1, 2) .containsSubsequence(1, 3); // assertion will fail assertThat(atomicLongArray).containsSubsequence(2, 1);
- Parameters:
subsequence
- the subsequence of values to look for.- Returns:
- myself assertion object.
- Throws:
AssertionError
- if the actual atomic array isnull
.AssertionError
- if the given array isnull
.AssertionError
- if the actual atomic array does not contain the given subsequence.- Since:
- 2.7.0 / 3.7.0
-
contains
public AtomicLongArrayAssert contains(long value, Index index)
Verifies that the actual atomic array contains the given value at the given index.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertions will pass assertThat(atomicLongArray).contains(1, atIndex(O)) .contains(3, atIndex(2)); // assertions will fail assertThat(atomicLongArray).contains(1, atIndex(1)); assertThat(atomicLongArray).contains(4, atIndex(2));
- Parameters:
value
- the value to look for.index
- the index where the value should be stored in the actual atomic array.- Returns:
- myself assertion object.
- Throws:
AssertionError
- if the actual atomic array isnull
or empty.NullPointerException
- if the givenIndex
isnull
.IndexOutOfBoundsException
- if the value of the givenIndex
is equal to or greater than the size of the actual atomic array.AssertionError
- if the actual atomic array does not contain the given value at the given index.- Since:
- 2.7.0 / 3.7.0
-
doesNotContain
public AtomicLongArrayAssert doesNotContain(long... values)
Verifies that the actual atomic array does not contain the given values.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).doesNotContain(4); // assertion will fail assertThat(atomicLongArray).doesNotContain(2);
- Parameters:
values
- the given values.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the given argument isnull
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual atomic array isnull
.AssertionError
- if the actual atomic array contains any of the given values.- Since:
- 2.7.0 / 3.7.0
-
doesNotContain
public AtomicLongArrayAssert doesNotContain(long value, Index index)
Verifies that the actual atomic array does not contain the given value at the given index.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertions will pass assertThat(atomicLongArray).doesNotContain(1, atIndex(1)) .doesNotContain(2, atIndex(0)); // assertions will fail assertThat(atomicLongArray).doesNotContain(1, atIndex(0)); assertThat(atomicLongArray).doesNotContain(2, atIndex(1));
- Parameters:
value
- the value to look for.index
- the index where the value should be stored in the actual atomic array.- Returns:
- myself assertion object.
- Throws:
AssertionError
- if the actual atomic array isnull
.NullPointerException
- if the givenIndex
isnull
.AssertionError
- if the actual atomic array contains the given value at the given index.- Since:
- 2.7.0 / 3.7.0
-
doesNotHaveDuplicates
public AtomicLongArrayAssert doesNotHaveDuplicates()
Verifies that the actual atomic array does not contain duplicates.Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).doesNotHaveDuplicates(); // assertion will fail assertThat(new AtomicLongArray(new long[] { 1, 1, 2, 3 })).doesNotHaveDuplicates();
- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual atomic array isnull
.AssertionError
- if the actual atomic array contains duplicates.- Since:
- 2.7.0 / 3.7.0
-
startsWith
public AtomicLongArrayAssert startsWith(long... sequence)
Verifies that the actual atomic array starts with the given sequence of values, without any other values between them. Similar to
, but it also verifies that the first element in the sequence is also first element of the actual atomic array.containsSequence(long...)
Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).startsWith(1, 2); // assertion will fail assertThat(atomicLongArray).startsWith(2, 3);
- Parameters:
sequence
- the sequence of values to look for.- Returns:
- myself assertion object.
- Throws:
NullPointerException
- if the given argument isnull
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual atomic array isnull
.AssertionError
- if the actual atomic array does not start with the given sequence.- Since:
- 2.7.0 / 3.7.0
-
endsWith
public AtomicLongArrayAssert endsWith(long... sequence)
Verifies that the actual atomic array ends with the given sequence of values, without any other values between them. Similar to
, but it also verifies that the last element in the sequence is also last element of the actual atomic array.containsSequence(long...)
Example:
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).endsWith(2, 3); // assertion will fail assertThat(atomicLongArray).endsWith(3, 4);
- Parameters:
sequence
- the sequence of values to look for.- Returns:
- myself assertion object.
- Throws:
NullPointerException
- if the given argument isnull
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the actual atomic array isnull
.AssertionError
- if the actual atomic array does not end with the given sequence.- Since:
- 2.7.0 / 3.7.0
-
isSorted
public AtomicLongArrayAssert isSorted()
Verifies that the actual AtomicLongArray is sorted in ascending order according to the natural ordering of its elements.Empty or one element arrays are considered sorted (unless the array element type is not Comparable).
- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual AtomicLongArray is not sorted in ascending order according to the natural ordering of its elements.AssertionError
- if the actual AtomicLongArray isnull
.
-
isSortedAccordingTo
public AtomicLongArrayAssert isSortedAccordingTo(Comparator<? super Long> comparator)
Verifies that the actual AtomicLongArray is sorted according to the given comparator.
Empty arrays are considered sorted whatever the comparator is.
One element arrays are considered sorted if the element is compatible with comparator, otherwise an AssertionError is thrown.- Parameters:
comparator
- theComparator
used to compare array elements- Returns:
this
assertion object.- Throws:
AssertionError
- if the actual AtomicLongArray is not sorted according to the given comparator.AssertionError
- if the actual AtomicLongArray isnull
.NullPointerException
- if the given comparator isnull
.
-
usingElementComparator
public AtomicLongArrayAssert usingElementComparator(Comparator<? super Long> customComparator)
Use given custom comparator instead of relying on Longequals
method to compare elements for incoming assertion checks.Custom comparator is bound to the current assertion instance, meaning that if a new assertion is created, it will use default comparison strategy.
Examples :
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // absolute value comparator Comparator<Long> absComparator = ...; assertThat(invoiceList).usingComparator(absComparator).contains(-1, -2, 3);
- Parameters:
customComparator
- the comparator to use for incoming assertion checks.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the given comparator isnull
.
-
usingDefaultElementComparator
public AtomicLongArrayAssert usingDefaultElementComparator()
Revert to standard comparison for incoming assertion group element checks.This method should be used to disable a custom comparison strategy set by calling
EnumerableAssert.usingElementComparator(Comparator)
.- Returns:
this
assertion object.
-
containsExactly
public AtomicLongArrayAssert containsExactly(long... values)
Verifies that the actual AtomicLongArray contains only the given values and nothing else, in order.Example :
AtomicLongArray atomicLongArray = new AtomicLongArray(new long[] { 1, 2, 3 }); // assertion will pass assertThat(atomicLongArray).containsExactly(1, 2, 3); // assertion will fail as actual and expected order differ assertThat(atomicLongArray).containsExactly(2, 1, 3);
- Parameters:
values
- the given values.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the given argument isnull
.AssertionError
- if the actual AtomicLongArray isnull
.AssertionError
- if the actual AtomicLongArray does not contain the given values with same order, i.e. it contains some or none of the given values, or more values than the given ones or values are the same but the order is not.- Since:
- 2.7.0 / 3.7.0
-
containsExactlyInAnyOrder
public AtomicLongArrayAssert containsExactlyInAnyOrder(long... values)
Verifies that the actual AtomicLongArray contains exactly the given values and nothing else, in any order.
Example :
// assertions will pass assertThat(new AtomicLongArray(new long[] { 1, 2 })).containsExactlyInAnyOrder(1, 2); assertThat(new AtomicLongArray(new long[] { 1, 2, 1 })).containsExactlyInAnyOrder(1, 1, 2); // assertions will fail assertThat(new AtomicLongArray(new long[] { 1, 2 })).containsExactlyInAnyOrder(1); assertThat(new AtomicLongArray(new long[] { 1 })).containsExactlyInAnyOrder(1, 2); assertThat(new AtomicLongArray(new long[] { 1, 2, 1 })).containsExactlyInAnyOrder(1, 2);
- Parameters:
values
- the given values.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the given argument isnull
.AssertionError
- if the actual AtomicLongArray isnull
.AssertionError
- if the actual AtomicLongArray does not contain the given values, i.e. it contains some or none of the given values, or more values than the given ones.- Since:
- 2.7.0 / 3.7.0
-
containsAnyOf
public AtomicLongArrayAssert containsAnyOf(long... values)
Verifies that the actual array contains at least one of the given values.Example :
AtomicLongArray oneTwoThree = new AtomicLongArray(new long[] { 1L, 2L, 3L }); // assertions will pass assertThat(oneTwoThree).containsAnyOf(2L) .containsAnyOf(2L, 3L) .containsAnyOf(1L, 2L, 3L) .containsAnyOf(1L, 2L, 3L, 4L) .containsAnyOf(5L, 6L, 7L, 2L); // assertions will fail assertThat(oneTwoThree).containsAnyOf(4L); assertThat(oneTwoThree).containsAnyOf(4L, 5L, 6L, 7L);
- Parameters:
values
- the values whose at least one which is expected to be in the array under test.- Returns:
this
assertion object.- Throws:
NullPointerException
- if the array of values isnull
.IllegalArgumentException
- if the array of values is empty and the array under test is not empty.AssertionError
- if the array under test isnull
.AssertionError
- if the array under test does not contain any of the givenvalues
.- Since:
- 2.9.0 / 3.9.0
-
-