Package org.fest.assertions
Class IntArrayAssert
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<int[]>
org.fest.assertions.IntArrayAssert
Understands assertion methods for
int arrays. To create a new instance of this class use the
method Assertions.assertThat(int[]).-
Field Summary
Fields inherited from class org.fest.assertions.GenericAssert
actual -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIntArrayAssert(int... actual) Creates a newIntArrayAssert. -
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.AssertionErrorcontains(int... values) Verifies that the actualintarray contains the given values.containsOnly(int... values) Verifies that the actualintarray 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<int[]> condition) Verifies that the actualintarray does not satisfy the given condition.excludes(int... values) Verifies that the actualintarray does not contain the given values.hasSize(int expected) Verifies that the number of elements in the actualintarray is equal to the given one.Alias for.satisfies(Condition)isEqualTo(int[] expected) Verifies that the actualintarray is equal to the given array.Alias for.doesNotSatisfy(Condition)Verifies that the actualintarray contains at least on element.isNotEqualTo(int[] array) Verifies that the actualintarray is not equal to the given array.Verifies that the actualintarray is notnull.isNotSameAs(int[] expected) Verifies that the actualintarray is not the same as the given array.isSameAs(int[] expected) Verifies that the actualintarray 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 actualintarray satisfies the given condition.Methods inherited from class org.fest.assertions.ArrayAssert
actualAsList, actualAsSet, actualGroupSizeMethods inherited from class org.fest.assertions.ItemGroupAssert
assertContains, assertContainsOnly, assertDoesNotHaveDuplicates, assertExcludes, asSet, validateIsNotNullMethods inherited from class org.fest.assertions.GroupAssert
assertHasSize, assertIsNotEmpty, isEmpty, isNullOrEmptyMethods 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
-
Constructor Details
-
IntArrayAssert
protected IntArrayAssert(int... actual) Creates a newIntArrayAssert.- Parameters:
actual- the target 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 classGroupAssert<int[]>- 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 classGroupAssert<int[]>- 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 classGroupAssert<int[]>- 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 classGroupAssert<int[]>- Parameters:
description- the description of the actual value.- Returns:
- this assertion object.
-
contains
Verifies that the actualintarray contains the given values.- Parameters:
values- the values to look for.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualintarray isnull.NullPointerException- if the givenintarray isnull.AssertionError- if the actualintarray does not contain the given values.
-
containsOnly
Verifies that the actualintarray contains the given values only.- Parameters:
values- the values to look for.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualintarray isnull.NullPointerException- if the givenintarray isnull.AssertionError- if the actualintarray does not contain the given objects, or if the actualintarray contains elements other than the ones specified.
-
excludes
Verifies that the actualintarray does not contain the given values.- Parameters:
values- the values the array should exclude.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualintarray isnull.NullPointerException- if the givenintarray isnull.AssertionError- if the actualintarray contains any of the given values.
-
satisfies
Verifies that the actualintarray satisfies the given condition.- Specified by:
satisfiesin classGenericAssert<int[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualintarray does not satisfy the given condition.- See Also:
-
doesNotSatisfy
Verifies that the actualintarray does not satisfy the given condition.- Specified by:
doesNotSatisfyin classGenericAssert<int[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualintarray satisfies the given condition.- See Also:
-
is
Alias for.satisfies(Condition)- Specified by:
isin classGenericAssert<int[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualintarray does not satisfy the given condition.- Since:
- 1.2
-
isNot
Alias for.doesNotSatisfy(Condition)- Specified by:
isNotin classGenericAssert<int[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualintarray satisfies the given condition.- Since:
- 1.2
-
isNotNull
Verifies that the actualintarray is notnull.- Specified by:
isNotNullin classGenericAssert<int[]>- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualintarray isnull.
-
isNotEmpty
Verifies that the actualintarray contains at least on element.- Specified by:
isNotEmptyin classGroupAssert<int[]>- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualintarray isnull.AssertionError- if the actualintarray is empty.
-
isEqualTo
Verifies that the actualintarray is equal to the given array. Array equality is checked by.Arrays.equals(int[], int[])- Specified by:
isEqualToin classGenericAssert<int[]>- Parameters:
expected- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualintarray is not equal to the given one.
-
isNotEqualTo
Verifies that the actualintarray is not equal to the given array. Array equality is checked by.Arrays.equals(int[], int[])- Specified by:
isNotEqualToin classGenericAssert<int[]>- Parameters:
array- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualintarray is equal to the given one.
-
hasSize
Verifies that the number of elements in the actualintarray is equal to the given one.- Specified by:
hasSizein classGroupAssert<int[]>- Parameters:
expected- the expected number of elements in the actualintarray.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualintarray isnull.AssertionError- if the number of elements in the actualintarray is not equal to the given one.
-
isSameAs
Verifies that the actualintarray is the same as the given array.- Specified by:
isSameAsin classGenericAssert<int[]>- Parameters:
expected- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualintarray is not the same as the given one.
-
isNotSameAs
Verifies that the actualintarray is not the same as the given array.- Specified by:
isNotSameAsin classGenericAssert<int[]>- Parameters:
expected- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualintarray 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:
overridingErrorMessagein classGroupAssert<int[]>- Parameters:
message- the given error message, which will replace the default one.- Returns:
- this assertion.
-