public class ByteArrays extends Object
byte
s.Constructor and Description |
---|
ByteArrays(ComparisonStrategy comparisonStrategy) |
Modifier and Type | Method and Description |
---|---|
void |
assertContains(AssertionInfo info,
byte[] actual,
byte[] values)
Asserts that the given array contains the given values, in any order.
|
void |
assertContains(AssertionInfo info,
byte[] actual,
byte value,
Index index)
Verifies that the given array contains the given value at the given index.
|
void |
assertContains(AssertionInfo info,
byte[] actual,
int[] values)
Asserts that the given array contains the given values, in any order.
|
void |
assertContains(AssertionInfo info,
byte[] actual,
int value,
Index index)
Verifies that the given array contains the given value at the given index.
|
void |
assertContainsAnyOf(AssertionInfo info,
byte[] actual,
byte[] values) |
void |
assertContainsExactly(AssertionInfo info,
byte[] actual,
byte[] values) |
void |
assertContainsExactly(AssertionInfo info,
byte[] actual,
int[] values) |
void |
assertContainsExactlyInAnyOrder(AssertionInfo info,
byte[] actual,
byte[] values) |
void |
assertContainsExactlyInAnyOrder(AssertionInfo info,
byte[] actual,
int[] values) |
void |
assertContainsOnly(AssertionInfo info,
byte[] actual,
byte[] values)
Asserts that the given array contains only the given values and nothing else, in any order.
|
void |
assertContainsOnly(AssertionInfo info,
byte[] actual,
int[] values)
Asserts that the given array contains only the given values and nothing else, in any order.
|
void |
assertContainsOnlyOnce(AssertionInfo info,
byte[] actual,
byte[] values)
Asserts that the given array contains only once the given values.
|
void |
assertContainsOnlyOnce(AssertionInfo info,
byte[] actual,
int[] values)
Asserts that the given array contains only once the given values.
|
void |
assertContainsSequence(AssertionInfo info,
byte[] actual,
byte[] sequence)
Verifies that the given array contains the given sequence of values, without any other values between them.
|
void |
assertContainsSequence(AssertionInfo info,
byte[] actual,
int[] sequence)
Verifies that the given array contains the given sequence of values, without any other values between them.
|
void |
assertContainsSubsequence(AssertionInfo info,
byte[] actual,
byte[] subsequence)
Verifies that the given array contains the given sequence of values (possibly with other values between them).
|
void |
assertContainsSubsequence(AssertionInfo info,
byte[] actual,
int[] subsequence)
Verifies that the given array contains the given sequence of values (possibly with other values between them).
|
void |
assertDoesNotContain(AssertionInfo info,
byte[] actual,
byte[] values)
Asserts that the given array does not contain the given values.
|
void |
assertDoesNotContain(AssertionInfo info,
byte[] actual,
byte value,
Index index)
Verifies that the given array does not contain the given value at the given index.
|
void |
assertDoesNotContain(AssertionInfo info,
byte[] actual,
int[] values)
Asserts that the given array does not contain the given values.
|
void |
assertDoesNotContain(AssertionInfo info,
byte[] actual,
int value,
Index index)
Verifies that the given array does not contain the given value at the given index.
|
void |
assertDoesNotHaveDuplicates(AssertionInfo info,
byte[] actual)
Asserts that the given array does not have duplicate values.
|
void |
assertEmpty(AssertionInfo info,
byte[] actual)
Asserts that the given array is empty.
|
void |
assertEndsWith(AssertionInfo info,
byte[] actual,
byte[] sequence)
Verifies that the given array ends with the given sequence of values, without any other values between them.
|
void |
assertEndsWith(AssertionInfo info,
byte[] actual,
int[] sequence)
Verifies that the given array ends with the given sequence of values, without any other values between them.
|
void |
assertHasSameSizeAs(AssertionInfo info,
byte[] actual,
Iterable<?> other)
Assert that the actual array has the same size as the other
Iterable . |
void |
assertHasSize(AssertionInfo info,
byte[] actual,
int expectedSize)
Asserts that the number of elements in the given array is equal to the expected one.
|
void |
assertHasSizeBetween(AssertionInfo info,
byte[] actual,
int lowerBoundary,
int higherBoundary)
Asserts that the number of elements in the given array is between the given lower and higher boundary (inclusive).
|
void |
assertHasSizeGreaterThan(AssertionInfo info,
byte[] actual,
int boundary)
Asserts that the number of elements in the given array is greater than the given boundary.
|
void |
assertHasSizeGreaterThanOrEqualTo(AssertionInfo info,
byte[] actual,
int boundary)
Asserts that the number of elements in the given array is greater than or equal to the given boundary.
|
void |
assertHasSizeLessThan(AssertionInfo info,
byte[] actual,
int boundary)
Asserts that the number of elements in the given array is less than the given boundary.
|
void |
assertHasSizeLessThanOrEqualTo(AssertionInfo info,
byte[] actual,
int boundary)
Asserts that the number of elements in the given array is less than or equal to the given boundary.
|
void |
assertIsSorted(AssertionInfo info,
byte[] actual)
Concrete implementation of
ArraySortedAssert.isSorted() . |
void |
assertIsSortedAccordingToComparator(AssertionInfo info,
byte[] actual,
Comparator<? super Byte> comparator)
Concrete implementation of
ArraySortedAssert.isSortedAccordingTo(Comparator) . |
void |
assertNotEmpty(AssertionInfo info,
byte[] actual)
Asserts that the given array is not empty.
|
void |
assertNullOrEmpty(AssertionInfo info,
byte[] actual)
Asserts that the given array is
null or empty. |
void |
assertStartsWith(AssertionInfo info,
byte[] actual,
byte[] sequence)
Verifies that the given array starts with the given sequence of values, without any other values between them.
|
void |
assertStartsWith(AssertionInfo info,
byte[] actual,
int[] sequence)
Verifies that the given array starts with the given sequence of values, without any other values between them.
|
Comparator<?> |
getComparator() |
static ByteArrays |
instance()
Returns the singleton instance of this class.
|
void |
setArrays(Arrays arrays) |
byte[] |
toByteArray(int[] ints) |
public ByteArrays(ComparisonStrategy comparisonStrategy)
public static ByteArrays instance()
public void setArrays(Arrays arrays)
public Comparator<?> getComparator()
public void assertNullOrEmpty(AssertionInfo info, byte[] actual)
null
or empty.info
- contains information about the assertion.actual
- the given array.AssertionError
- if the given array is not null
*and* contains one or more elements.public void assertEmpty(AssertionInfo info, byte[] actual)
info
- contains information about the assertion.actual
- the given array.AssertionError
- if the given array is null
.AssertionError
- if the given array is not empty.public void assertNotEmpty(AssertionInfo info, byte[] actual)
info
- contains information about the assertion.actual
- the given array.AssertionError
- if the given array is null
.AssertionError
- if the given array is empty.public void assertHasSize(AssertionInfo info, byte[] actual, int expectedSize)
info
- contains information about the assertion.actual
- the given array.expectedSize
- the expected size of actual
.AssertionError
- if the given array is null
.AssertionError
- if the number of elements in the given array is different than the expected one.public void assertHasSizeGreaterThan(AssertionInfo info, byte[] actual, int boundary)
info
- contains information about the assertion.actual
- the given array.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given array is null
.AssertionError
- if the number of elements in the given array is not greater than the boundary.public void assertHasSizeGreaterThanOrEqualTo(AssertionInfo info, byte[] actual, int boundary)
info
- contains information about the assertion.actual
- the given array.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given array is null
.AssertionError
- if the number of elements in the given array is not greater than or equal to the boundary.public void assertHasSizeLessThan(AssertionInfo info, byte[] actual, int boundary)
info
- contains information about the assertion.actual
- the given array.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given array is null
.AssertionError
- if the number of elements in the given array is not less than the boundary.public void assertHasSizeLessThanOrEqualTo(AssertionInfo info, byte[] actual, int boundary)
info
- contains information about the assertion.actual
- the given array.boundary
- the given value to compare the size of actual
to.AssertionError
- if the given array is null
.AssertionError
- if the number of elements in the given array is not less than or equal to the boundary.public void assertHasSizeBetween(AssertionInfo info, byte[] actual, int lowerBoundary, int higherBoundary)
info
- contains information about the assertion.actual
- the given array.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.AssertionError
- if the given array is null
.AssertionError
- if the number of elements in the given array is not between the boundaries.public void assertHasSameSizeAs(AssertionInfo info, byte[] actual, Iterable<?> other)
Iterable
.info
- contains information about the assertion.actual
- the given array.other
- the group to compareAssertionError
- if the actual group is null
.AssertionError
- if the other group is null
.AssertionError
- if the actual group does not have the same size.public void assertContains(AssertionInfo info, byte[] actual, byte[] values)
info
- contains information about the assertion.actual
- the given array.values
- the values that are expected to be in the given array.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given array is null
.AssertionError
- if the given array does not contain the given values.public void assertContains(AssertionInfo info, byte[] actual, int[] values)
info
- contains information about the assertion.actual
- the given array.values
- the values that are expected to be in the given array.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given array is null
.AssertionError
- if the given array does not contain the given values.public void assertContains(AssertionInfo info, byte[] actual, byte value, Index index)
info
- contains information about the assertion.actual
- the given array.value
- the value to look for.index
- the index where the value should be stored in the given array.AssertionError
- if the given array is null
or empty.NullPointerException
- if the given Index
is null
.IndexOutOfBoundsException
- if the value of the given Index
is equal to or greater than the size of the given
array.AssertionError
- if the given array does not contain the given value at the given index.public void assertContains(AssertionInfo info, byte[] actual, int value, Index index)
info
- contains information about the assertion.actual
- the given array.value
- the value to look for.index
- the index where the value should be stored in the given array.AssertionError
- if the given array is null
or empty.NullPointerException
- if the given Index
is null
.IndexOutOfBoundsException
- if the value of the given Index
is equal to or greater than the size of the given
array.AssertionError
- if the given array does not contain the given value at the given index.public void assertDoesNotContain(AssertionInfo info, byte[] actual, byte value, Index index)
info
- contains information about the assertion.actual
- the given array.value
- the value to look for.index
- the index where the value should be stored in the given array.AssertionError
- if the given array is null
.NullPointerException
- if the given Index
is null
.AssertionError
- if the given array contains the given value at the given index.public void assertDoesNotContain(AssertionInfo info, byte[] actual, int value, Index index)
info
- contains information about the assertion.actual
- the given array.value
- the value to look for.index
- the index where the value should be stored in the given array.AssertionError
- if the given array is null
.NullPointerException
- if the given Index
is null
.AssertionError
- if the given array contains the given value at the given index.public void assertContainsOnly(AssertionInfo info, byte[] actual, byte[] values)
info
- contains information about the assertion.actual
- the given array.values
- the values that are expected to be in the given array.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given array is null
.AssertionError
- if the given array does not contain the given values or if the given array contains values that are
not in the given array.public void assertContainsOnly(AssertionInfo info, byte[] actual, int[] values)
info
- contains information about the assertion.actual
- the given array.values
- the values that are expected to be in the given array.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given array is null
.AssertionError
- if the given array does not contain the given values or if the given array contains values that are
not in the given array.public void assertContainsExactly(AssertionInfo info, byte[] actual, byte[] values)
public void assertContainsExactly(AssertionInfo info, byte[] actual, int[] values)
public void assertContainsExactlyInAnyOrder(AssertionInfo info, byte[] actual, byte[] values)
public void assertContainsExactlyInAnyOrder(AssertionInfo info, byte[] actual, int[] values)
public void assertContainsOnlyOnce(AssertionInfo info, byte[] actual, byte[] values)
info
- contains information about the assertion.actual
- the given array.values
- the values that are expected to be in the given array.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given array is null
.AssertionError
- if the given array does not contain the given values or if the given array contains more
than once values.public void assertContainsOnlyOnce(AssertionInfo info, byte[] actual, int[] values)
info
- contains information about the assertion.actual
- the given array.values
- the values that are expected to be in the given array.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given array is null
.AssertionError
- if the given array does not contain the given values or if the given array contains more
than once values.public void assertContainsSequence(AssertionInfo info, byte[] actual, byte[] sequence)
info
- contains information about the assertion.actual
- the given array.sequence
- the sequence of values to look for.AssertionError
- if the given array is null
.NullPointerException
- if the given sequence is null
.IllegalArgumentException
- if the given sequence is empty.AssertionError
- if the given array does not contain the given sequence of values.public void assertContainsSequence(AssertionInfo info, byte[] actual, int[] sequence)
info
- contains information about the assertion.actual
- the given array.sequence
- the sequence of values to look for.AssertionError
- if the given array is null
.NullPointerException
- if the given sequence is null
.IllegalArgumentException
- if the given sequence is empty.AssertionError
- if the given array does not contain the given sequence of values.public void assertContainsSubsequence(AssertionInfo info, byte[] actual, byte[] subsequence)
info
- contains information about the assertion.actual
- the given array.subsequence
- the subsequence of values to look for.AssertionError
- if the given array is null
.NullPointerException
- if the given sequence is null
.IllegalArgumentException
- if the given sequence is empty.AssertionError
- if the given array does not contain the given sequence of values.public void assertContainsSubsequence(AssertionInfo info, byte[] actual, int[] subsequence)
info
- contains information about the assertion.actual
- the given array.subsequence
- the subsequence of values to look for.AssertionError
- if the given array is null
.NullPointerException
- if the given sequence is null
.IllegalArgumentException
- if the given sequence is empty.AssertionError
- if the given array does not contain the given sequence of values.public void assertDoesNotContain(AssertionInfo info, byte[] actual, byte[] values)
info
- contains information about the assertion.actual
- the given array.values
- the values that are expected not to be in the given array.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given array is null
.AssertionError
- if the given array contains any of given values.public void assertDoesNotContain(AssertionInfo info, byte[] actual, int[] values)
info
- contains information about the assertion.actual
- the given array.values
- the values that are expected not to be in the given array.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given array is null
.AssertionError
- if the given array contains any of given values.public void assertDoesNotHaveDuplicates(AssertionInfo info, byte[] actual)
info
- contains information about the assertion.actual
- the given array.NullPointerException
- if the array of values is null
.IllegalArgumentException
- if the array of values is empty.AssertionError
- if the given array is null
.AssertionError
- if the given array contains duplicate values.public void assertStartsWith(AssertionInfo info, byte[] actual, byte[] sequence)
assertContainsSequence(AssertionInfo, byte[], byte[])
, but it also verifies that the first element in
the sequence is also the first element of the given array.info
- contains information about the assertion.actual
- the given array.sequence
- the sequence of values to look for.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the given array is null
.AssertionError
- if the given array does not start with the given sequence of values.public void assertStartsWith(AssertionInfo info, byte[] actual, int[] sequence)
assertContainsSequence(AssertionInfo, byte[], byte[])
, but it also verifies that the first element in
the sequence is also the first element of the given array.info
- contains information about the assertion.actual
- the given array.sequence
- the sequence of values to look for.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the given array is null
.AssertionError
- if the given array does not start with the given sequence of values.public void assertEndsWith(AssertionInfo info, byte[] actual, byte[] sequence)
assertContainsSequence(AssertionInfo, byte[], byte[])
, but it also verifies that the last element in
the sequence is also the last element of the given array.info
- contains information about the assertion.actual
- the given array.sequence
- the sequence of values to look for.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the given array is null
.AssertionError
- if the given array does not end with the given sequence of values.public void assertEndsWith(AssertionInfo info, byte[] actual, int[] sequence)
assertContainsSequence(AssertionInfo, byte[], byte[])
, but it also verifies that the last element in
the sequence is also the last element of the given array.info
- contains information about the assertion.actual
- the given array.sequence
- the sequence of values to look for.NullPointerException
- if the given argument is null
.IllegalArgumentException
- if the given argument is an empty array.AssertionError
- if the given array is null
.AssertionError
- if the given array does not end with the given sequence of values.public void assertIsSorted(AssertionInfo info, byte[] actual)
ArraySortedAssert.isSorted()
.info
- contains information about the assertion.actual
- the given array.public void assertIsSortedAccordingToComparator(AssertionInfo info, byte[] actual, Comparator<? super Byte> comparator)
ArraySortedAssert.isSortedAccordingTo(Comparator)
.info
- contains information about the assertion.actual
- the given array.comparator
- the Comparator
used to compare array elementspublic byte[] toByteArray(int[] ints)
public void assertContainsAnyOf(AssertionInfo info, byte[] actual, byte[] values)
Copyright © 2014–2019 AssertJ. All rights reserved.