Package org.fest.assertions
Class LongArrayAssert
java.lang.Object
org.fest.assertions.Assert
org.fest.assertions.GenericAssert<T>
org.fest.assertions.GroupAssert<T>
org.fest.assertions.ItemGroupAssert<T>
org.fest.assertions.ArrayAssert<long[]>
org.fest.assertions.LongArrayAssert
Understands assertion methods for
long
arrays. To create a new instance of this class use the
method Assertions.assertThat(long[])
.-
Field Summary
Fields inherited from class org.fest.assertions.GenericAssert
actual
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
LongArrayAssert
(long... actual) Creates a newLongArrayAssert
. -
Method Summary
Modifier and TypeMethodDescriptionSets the description of the actual value, to be used in as message of any
thrown when an assertion fails.AssertionError
as
(Description description) Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails.AssertionError
contains
(long... values) Verifies that the actuallong
array contains the given values.containsOnly
(long... values) Verifies that the actuallong
array contains the given values only.describedAs
(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<long[]> condition) Verifies that the actuallong
array does not satisfy the given condition.excludes
(long... values) Verifies that the actuallong
array does not contain the given values.hasSize
(int expected) Verifies that the number of elements in the actuallong
array is equal to the given one.Alias for
.satisfies(Condition)
isEqualTo
(long[] expected) Verifies that the actuallong
array is equal to the given array.Alias for
.doesNotSatisfy(Condition)
Verifies that the actuallong
array contains at least on element.isNotEqualTo
(long[] array) Verifies that the actuallong
array is not equal to the given array.Verifies that the actuallong
array is notnull
.isNotSameAs
(long[] expected) Verifies that the actuallong
array is not the same as the given array.isSameAs
(long[] expected) Verifies that the actuallong
array is the same as the given array.overridingErrorMessage
(String message) Replaces the default message displayed in case of a failure with the given one.Verifies that the actuallong
array satisfies the given condition.Methods inherited from class org.fest.assertions.ArrayAssert
actualAsList, actualAsSet, actualGroupSize
Methods inherited from class org.fest.assertions.ItemGroupAssert
assertContains, assertContainsOnly, assertDoesNotHaveDuplicates, assertExcludes, asSet, validateIsNotNull
Methods inherited from class org.fest.assertions.GroupAssert
assertHasSize, assertIsNotEmpty, 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
-
Constructor Details
-
LongArrayAssert
protected LongArrayAssert(long... actual) Creates a newLongArrayAssert
.- Parameters:
actual
- the target to verify.
-
-
Method Details
-
as
Sets the description of the actual value, to be used in as message of any
thrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.AssertionError
For example:
assertThat(val).as("name").isEqualTo("Frodo");
- Specified by:
as
in classGroupAssert<long[]>
- 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:
describedAs
in classGroupAssert<long[]>
- 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 any
thrown when an assertion fails. This method should be called before any assertion method, otherwise any assertion failure will not show the provided description.AssertionError
For example:
assertThat(val).as(new BasicDescription("name")).isEqualTo("Frodo");
- Specified by:
as
in classGroupAssert<long[]>
- 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:
describedAs
in classGroupAssert<long[]>
- Parameters:
description
- the description of the actual value.- Returns:
- this assertion object.
-
contains
Verifies that the actuallong
array contains the given values.- Parameters:
values
- the values to look for.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actuallong
array isnull
.NullPointerException
- if the givenlong
array isnull
.AssertionError
- if the actuallong
array does not contain the given values.
-
containsOnly
Verifies that the actuallong
array contains the given values only.- Parameters:
values
- the values to look for.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actuallong
array isnull
.NullPointerException
- if the givenlong
array isnull
.AssertionError
- if the actuallong
array does not contain the given objects, or if the actuallong
array contains elements other than the ones specified.
-
excludes
Verifies that the actuallong
array does not contain the given values.- Parameters:
values
- the values the array should exclude.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actuallong
array isnull
.NullPointerException
- if the givenlong
array isnull
.AssertionError
- if the actuallong
array contains any of the given values.
-
satisfies
Verifies that the actuallong
array satisfies the given condition.- Specified by:
satisfies
in classGenericAssert<long[]>
- Parameters:
condition
- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException
- if the given condition isnull
.AssertionError
- if the actuallong
array does not satisfy the given condition.- See Also:
-
doesNotSatisfy
Verifies that the actuallong
array does not satisfy the given condition.- Specified by:
doesNotSatisfy
in classGenericAssert<long[]>
- Parameters:
condition
- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException
- if the given condition isnull
.AssertionError
- if the actuallong
array satisfies the given condition.- See Also:
-
is
Alias for
.satisfies(Condition)
- Specified by:
is
in classGenericAssert<long[]>
- Parameters:
condition
- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException
- if the given condition isnull
.AssertionError
- if the actuallong
array does not satisfy the given condition.- Since:
- 1.2
-
isNot
Alias for
.doesNotSatisfy(Condition)
- Specified by:
isNot
in classGenericAssert<long[]>
- Parameters:
condition
- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException
- if the given condition isnull
.AssertionError
- if the actuallong
array satisfies the given condition.- Since:
- 1.2
-
isNotNull
Verifies that the actuallong
array is notnull
.- Specified by:
isNotNull
in classGenericAssert<long[]>
- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actuallong
array isnull
.
-
isNotEmpty
Verifies that the actuallong
array contains at least on element.- Specified by:
isNotEmpty
in classGroupAssert<long[]>
- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actuallong
array isnull
.AssertionError
- if the actuallong
array is empty.
-
isEqualTo
Verifies that the actuallong
array is equal to the given array. Array equality is checked by
.Arrays.equals(long[], long[])
- Specified by:
isEqualTo
in classGenericAssert<long[]>
- Parameters:
expected
- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actuallong
array is not equal to the given one.
-
isNotEqualTo
Verifies that the actuallong
array is not equal to the given array. Array equality is checked by
.Arrays.equals(long[], long[])
- Specified by:
isNotEqualTo
in classGenericAssert<long[]>
- Parameters:
array
- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actuallong
array is equal to the given one.
-
hasSize
Verifies that the number of elements in the actuallong
array is equal to the given one.- Specified by:
hasSize
in classGroupAssert<long[]>
- Parameters:
expected
- the expected number of elements in the actuallong
array.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actuallong
array isnull
.AssertionError
- if the number of elements in the actuallong
array is not equal to the given one.
-
isSameAs
Verifies that the actuallong
array is the same as the given array.- Specified by:
isSameAs
in classGenericAssert<long[]>
- Parameters:
expected
- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actuallong
array is not the same as the given one.
-
isNotSameAs
Verifies that the actuallong
array is not the same as the given array.- Specified by:
isNotSameAs
in classGenericAssert<long[]>
- Parameters:
expected
- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError
- if the actuallong
array is the same as the given one.
-
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:
overridingErrorMessage
in classGroupAssert<long[]>
- Parameters:
message
- the given error message, which will replace the default one.- Returns:
- this assertion.
-