Package org.fest.assertions
Class ByteAssert
- All Implemented Interfaces:
NumberAssert
Understands assertion methods for
Bytes and bytes. To create a new instance of this class call
Assertions.assertThat(Byte) or Assertions.assertThat(byte).- Since:
- 1.2
-
Field Summary
FieldsFields inherited from class org.fest.assertions.GenericAssert
actual -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedByteAssert(byte actual) Creates a new.ByteAssert(package private)ByteAssert(int actual) protectedByteAssert(Byte actual) Creates a new.ByteAssert -
Method Summary
Modifier and TypeMethodDescriptionSets the description of the actual value, to be used in as message of anythrown when an assertion fails.AssertionErroras(Description description) Sets the description of the actual value, to be used in as message of anythrown when an assertion fails.AssertionErrordescribedAs(String description) Alias for, since "as" is a keyword in Groovy.GenericAssert.as(String)describedAs(Description description) Alias for, since "as" is a keyword in Groovy.GenericAssert.as(Description)doesNotSatisfy(Condition<Byte> condition) Verifies that the actualBytedoes not satisfy the given condition.Alias for.satisfies(Condition)isEqualTo(byte expected) Verifies that the actualBytevalue is equal to the given one.Verifies that the actualBytevalue is equal to the given one.isGreaterThan(byte other) Verifies that the actualBytevalue is greater than the given one.isGreaterThanOrEqualTo(byte other) Verifies that the actualBytevalue is greater or equal to the given one.isLessThan(byte other) Verifies that the actualBytevalue is less than the given one.isLessThanOrEqualTo(byte other) Verifies that the actualBytevalue is less or equal to the given one.Verifies that the actualBytevalue is negative.Alias for.doesNotSatisfy(Condition)isNotEqualTo(byte other) Verifies that the actualBytevalue is not equal to the given one.isNotEqualTo(Byte other) Verifies that the actualByteis not equal to the given one.Verifies that the actualByteis notnull.isNotSameAs(Byte other) Verifies that the actualByteis not the same object as the given one.Verifies that the actualBytevalue is positive.Verifies that the actualByteis the same object as the given one.isZero()Verifies that the actualBytevalue is equal to zero.overridingErrorMessage(String message) Replaces the default message displayed in case of a failure with the given one.Verifies that the actualBytesatisfies the given condition.Methods inherited from class org.fest.assertions.GenericAssert
assertDoesNotSatisfy, assertEqualTo, assertIs, assertIsNot, assertNotEqualTo, assertNotNull, assertNotSameAs, assertSameAs, assertSatisfies, isNullMethods inherited from class org.fest.assertions.Assert
customErrorMessage, description, description, description, equals, fail, fail, failIfCustomMessageIsSet, failIfCustomMessageIsSet, failure, formattedErrorMessage, hashCode, rawDescription, replaceDefaultErrorMessagesWith
-
Field Details
-
ZERO
private static final byte ZERO- See Also:
-
-
Constructor Details
-
ByteAssert
ByteAssert(int actual) -
ByteAssert
protected ByteAssert(byte actual) Creates a new.ByteAssert- Parameters:
actual- the actual value to verify.
-
ByteAssert
Creates a new.ByteAssert- Parameters:
actual- the actual value to verify.
-
-
Method Details
-
as
Sets the description of the actual value, to be used in as message of anythrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.AssertionErrorFor example:
assertThat(val).as("name").isEqualTo("Frodo");- Specified by:
asin classGenericAssert<Byte>- Parameters:
description- the description of the actual value.- Returns:
- this assertion object.
-
describedAs
Alias for, 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.GenericAssert.as(String)For example:
assertThat(val).describedAs("name").isEqualTo("Frodo");- Specified by:
describedAsin classGenericAssert<Byte>- Parameters:
description- the description of the actual value.- Returns:
- this assertion object.
-
as
Sets the description of the actual value, to be used in as message of anythrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.AssertionErrorFor example:
assertThat(val).as(new BasicDescription("name")).isEqualTo("Frodo");- Specified by:
asin classGenericAssert<Byte>- Parameters:
description- the description of the actual value.- Returns:
- this assertion object.
-
describedAs
Alias for, 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.GenericAssert.as(Description)For example:
assertThat(val).describedAs(new BasicDescription("name")).isEqualTo("Frodo");- Specified by:
describedAsin classGenericAssert<Byte>- Parameters:
description- the description of the actual value.- Returns:
- this assertion object.
-
isEqualTo
Verifies that the actualBytevalue is equal to the given one.- Parameters:
expected- the value to compare the actual one to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is not equal to the given one.
-
isEqualTo
Verifies that the actualBytevalue is equal to the given one.- Specified by:
isEqualToin classGenericAssert<Byte>- Parameters:
expected- the givenBytevalue to compare the actualByteto.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is not equal to the given one.- Since:
- 1.3
-
isNotEqualTo
Verifies that the actualBytevalue is not equal to the given one.- Parameters:
other- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is equal to the given one.
-
isNotEqualTo
Verifies that the actualByteis not equal to the given one.- Specified by:
isNotEqualToin classGenericAssert<Byte>- Parameters:
other- the givenByteto compare the actualByteto.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is equal to the given one.- Since:
- 1.3
-
isGreaterThan
Verifies that the actualBytevalue is greater than the given one.- Parameters:
other- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is not greater than the given one.
-
isLessThan
Verifies that the actualBytevalue is less than the given one.- Parameters:
other- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is not less than the given one.
-
isGreaterThanOrEqualTo
Verifies that the actualBytevalue is greater or equal to the given one.- Parameters:
other- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is not greater than or equal to the given one.
-
isLessThanOrEqualTo
Verifies that the actualBytevalue is less or equal to the given one.- Parameters:
other- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is not less than or equal to the given one.
-
isZero
Verifies that the actualBytevalue is equal to zero.- Specified by:
isZeroin interfaceNumberAssert- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is not equal to zero.
-
isPositive
Verifies that the actualBytevalue is positive.- Specified by:
isPositivein interfaceNumberAssert- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is not positive.
-
isNegative
Verifies that the actualBytevalue is negative.- Specified by:
isNegativein interfaceNumberAssert- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is not negative.
-
overridingErrorMessage
Replaces the default message displayed in case of a failure with the given one.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'".- Specified by:
overridingErrorMessagein classGenericAssert<Byte>- Parameters:
message- the given error message, which will replace the default one.- Returns:
- this assertion.
-
satisfies
Verifies that the actualBytesatisfies the given condition.- Specified by:
satisfiesin classGenericAssert<Byte>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualBytedoes not satisfy the given condition.- Since:
- 1.3
- See Also:
-
doesNotSatisfy
Verifies that the actualBytedoes not satisfy the given condition.- Specified by:
doesNotSatisfyin classGenericAssert<Byte>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualBytedoes satisfies the given condition.- Since:
- 1.3
- See Also:
-
is
Alias for.satisfies(Condition)- Specified by:
isin classGenericAssert<Byte>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualBytedoes not satisfy the given condition.- Since:
- 1.3
-
isNot
Alias for.doesNotSatisfy(Condition)- Specified by:
isNotin classGenericAssert<Byte>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualBytedoes not satisfy the given condition.- Since:
- 1.3
-
isNotNull
Verifies that the actualByteis notnull.- Specified by:
isNotNullin classGenericAssert<Byte>- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue isnull.- Since:
- 1.3
-
isSameAs
Verifies that the actualByteis the same object as the given one.- Specified by:
isSameAsin classGenericAssert<Byte>- Parameters:
expected- the givenByteto compare the actualByteto.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is not the same as the given one.- Since:
- 1.3
-
isNotSameAs
Verifies that the actualByteis not the same object as the given one.- Specified by:
isNotSameAsin classGenericAssert<Byte>- Parameters:
other- the givenByteto compare the actualByteto.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualBytevalue is the same as the given one.- Since:
- 1.3
-