|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.assertions.Assert
org.fest.assertions.GenericAssert<T>
org.fest.assertions.GroupAssert<T>
org.fest.assertions.ArrayAssert<byte[]>
org.fest.assertions.ByteArrayAssert
public class ByteArrayAssert
Understands assertion methods for byte
arrays. To create a new instance of this class use the
method
.
Assertions.assertThat(byte[])
Field Summary |
---|
Fields inherited from class org.fest.assertions.GenericAssert |
---|
actual |
Constructor Summary | |
---|---|
protected |
ByteArrayAssert(byte... actual)
Creates a new ByteArrayAssert . |
Method Summary | |
---|---|
ByteArrayAssert |
as(Description description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
ByteArrayAssert |
as(String description)
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. |
ByteArrayAssert |
contains(byte... values)
Verifies that the actual byte array contains the given values. |
ByteArrayAssert |
containsOnly(byte... values)
Verifies that the actual byte array contains the given values only. |
ByteArrayAssert |
describedAs(Description description)
Alias for , since "as" is a keyword in
Groovy. |
ByteArrayAssert |
describedAs(String description)
Alias for , since "as" is a keyword in
Groovy. |
ByteArrayAssert |
doesNotSatisfy(Condition<byte[]> condition)
Verifies that the actual byte array does not satisfy the given condition. |
ByteArrayAssert |
excludes(byte... values)
Verifies that the actual byte array does not contain the given values. |
ByteArrayAssert |
hasSize(int expected)
Verifies that the number of elements in the actual byte array is equal to the given one. |
ByteArrayAssert |
is(Condition<byte[]> condition)
Alias for . |
ByteArrayAssert |
isEqualTo(byte[] expected)
Verifies that the actual byte array is equal to the given array. |
ByteArrayAssert |
isNot(Condition<byte[]> condition)
Alias for . |
ByteArrayAssert |
isNotEmpty()
Verifies that the actual byte array contains at least on element. |
ByteArrayAssert |
isNotEqualTo(byte[] array)
Verifies that the actual byte array is not equal to the given array. |
ByteArrayAssert |
isNotNull()
Verifies that the actual byte array is not null . |
ByteArrayAssert |
isNotSameAs(byte[] expected)
Verifies that the actual byte array is not the same as the given array. |
ByteArrayAssert |
isSameAs(byte[] expected)
Verifies that the actual byte array is the same as the given array. |
ByteArrayAssert |
overridingErrorMessage(String message)
Replaces the default message displayed in case of a failure with the given one. |
ByteArrayAssert |
satisfies(Condition<byte[]> condition)
Verifies that the actual byte array satisfies the given condition. |
Methods inherited from class org.fest.assertions.ArrayAssert |
---|
actualGroupSize, actualInBrackets, assertContains, assertContainsOnly, assertExcludes, assertThatActualHasSize, assertThatActualIsNotEmpty, assertThatActualIsNotNull, isEmpty, isNullOrEmpty |
Methods inherited from class org.fest.assertions.GenericAssert |
---|
assertDoesNotSatisfy, assertEqualTo, assertIs, assertIsNot, assertNotEqualTo, assertNotNull, assertNotSameAs, assertSameAs, assertSatisfies, isNull |
Methods inherited from class org.fest.assertions.Assert |
---|
customErrorMessage, description, description, description, equals, fail, fail, failIfCustomMessageIsSet, failIfCustomMessageIsSet, failure, formattedErrorMessage, hashCode, rawDescription, replaceDefaultErrorMessagesWith |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ByteArrayAssert(byte... actual)
ByteArrayAssert
.
actual
- the target to verify.Method Detail |
---|
public ByteArrayAssert as(String description)
AssertionError
thrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion
failure will not show the provided description.
For example:
assertThat(val).as("name").isEqualTo("Frodo");
as
in class GenericAssert<byte[]>
description
- the description of the actual value.
public ByteArrayAssert describedAs(String description)
GenericAssert.as(String)
, since "as" is a keyword in
Groovy. This method should be called before any assertion
method, otherwise any assertion failure will not show the provided description.
For example:
assertThat(val).describedAs("name").isEqualTo("Frodo");
describedAs
in class GenericAssert<byte[]>
description
- the description of the actual value.
public ByteArrayAssert as(Description description)
AssertionError
thrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion
failure will not show the provided description.
For example:
assertThat(val).as(new BasicDescription("name")).isEqualTo("Frodo");
as
in class GenericAssert<byte[]>
description
- the description of the actual value.
public ByteArrayAssert describedAs(Description description)
GenericAssert.as(Description)
, since "as" is a keyword in
Groovy. This method should be called before any assertion
method, otherwise any assertion failure will not show the provided description.
For example:
assertThat(val).describedAs(new BasicDescription("name")).isEqualTo("Frodo");
describedAs
in class GenericAssert<byte[]>
description
- the description of the actual value.
public ByteArrayAssert contains(byte... values)
byte
array contains the given values.
values
- the values to look for.
AssertionError
- if the actual byte
array is null
.
NullPointerException
- if the given byte
array is null
.
AssertionError
- if the actual byte
array does not contain the given values.public ByteArrayAssert containsOnly(byte... values)
byte
array contains the given values only.
values
- the values to look for.
AssertionError
- if the actual byte
array is null
.
NullPointerException
- if the given byte
array is null
.
AssertionError
- if the actual byte
array does not contain the given objects, or if the actual
byte
array contains elements other than the ones specified.public ByteArrayAssert excludes(byte... values)
byte
array does not contain the given values.
values
- the values the array should exclude.
AssertionError
- if the actual byte
array is null
.
NullPointerException
- if the given byte
array is null
.
AssertionError
- if the actual byte
array contains any of the given values.public ByteArrayAssert satisfies(Condition<byte[]> condition)
byte
array satisfies the given condition.
satisfies
in class GenericAssert<byte[]>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual byte
array does not satisfy the given condition.is(Condition)
public ByteArrayAssert doesNotSatisfy(Condition<byte[]> condition)
byte
array does not satisfy the given condition.
doesNotSatisfy
in class GenericAssert<byte[]>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual byte
array satisfies the given condition.isNot(Condition)
public ByteArrayAssert is(Condition<byte[]> condition)
satisfies(Condition)
.
is
in class GenericAssert<byte[]>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual byte
array does not satisfy the given condition.public ByteArrayAssert isNot(Condition<byte[]> condition)
doesNotSatisfy(Condition)
.
isNot
in class GenericAssert<byte[]>
condition
- the given condition.
NullPointerException
- if the given condition is null
.
AssertionError
- if the actual byte
array satisfies the given condition.public ByteArrayAssert isNotNull()
byte
array is not null
.
isNotNull
in class GenericAssert<byte[]>
AssertionError
- if the actual byte
array is null
.public ByteArrayAssert isNotEmpty()
byte
array contains at least on element.
isNotEmpty
in class GroupAssert<byte[]>
AssertionError
- if the actual byte
array is null
.
AssertionError
- if the actual byte
array is empty.public ByteArrayAssert isEqualTo(byte[] expected)
byte
array is equal to the given array. Array equality is checked by
Arrays.equals(byte[], byte[])
.
isEqualTo
in class GenericAssert<byte[]>
expected
- the given array to compare the actual array to.
AssertionError
- if the actual byte
array is not equal to the given one.public ByteArrayAssert isNotEqualTo(byte[] array)
byte
array is not equal to the given array. Array equality is checked by
Arrays.equals(byte[], byte[])
.
isNotEqualTo
in class GenericAssert<byte[]>
array
- the given array to compare the actual array to.
AssertionError
- if the actual byte
array is equal to the given one.public ByteArrayAssert hasSize(int expected)
byte
array is equal to the given one.
hasSize
in class GroupAssert<byte[]>
expected
- the expected number of elements in the actual byte
array.
AssertionError
- if the actual byte
array is null
.
AssertionError
- if the number of elements in the actual byte
array is not equal to the given
one.public ByteArrayAssert isSameAs(byte[] expected)
byte
array is the same as the given array.
isSameAs
in class GenericAssert<byte[]>
expected
- the given array to compare the actual array to.
AssertionError
- if the actual byte
array is not the same as the given one.public ByteArrayAssert isNotSameAs(byte[] expected)
byte
array is not the same as the given array.
isNotSameAs
in class GenericAssert<byte[]>
expected
- the given array to compare the actual array to.
AssertionError
- if the actual byte
array is the same as the given one.public ByteArrayAssert overridingErrorMessage(String message)
For example, the following assertion:
assertThat("Hello").isEqualTo("Bye");will fail with the default message "expected:<'[Bye]'> but was:<'[Hello]'>."
We can replace this message with our own:
assertThat("Hello").overridingErrorMessage("'Hello' should be equal to 'Bye'").isEqualTo("Bye");in this case, the assertion will fail showing the message "'Hello' should be equal to 'Bye'".
overridingErrorMessage
in class GenericAssert<byte[]>
message
- the given error message, which will replace the default one.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |