Package org.fest.assertions
Class CharArrayAssert
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<char[]>
org.fest.assertions.CharArrayAssert
Understands assertion methods for
char arrays. To create a new instance of this class use the
method Assertions.assertThat(char[]).-
Field Summary
Fields inherited from class org.fest.assertions.GenericAssert
actual -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCharArrayAssert(char... actual) Creates a newCharArrayAssert. -
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(char... values) Verifies that the actualchararray contains the given values.containsOnly(char... values) Verifies that the actualchararray contains the given values only.describedAs(String description) Alias for, since "as" is a keyword in Groovy.as(String)describedAs(Description description) Alias for, since "as" is a keyword in Groovy.as(Description)doesNotSatisfy(Condition<char[]> condition) Verifies that the actualchararray does not satisfy the given condition.excludes(char... values) Verifies that the actualchararray does not contain the given values.hasSize(int expected) Verifies that the number of elements in the actualchararray is equal to the given one.Alias for.satisfies(Condition)isEqualTo(char[] expected) Verifies that the actualchararray is equal to the given array.Alias for.doesNotSatisfy(Condition)Verifies that the actualchararray contains at least on element.isNotEqualTo(char[] array) Verifies that the actualchararray is not equal to the given array.Verifies that the actualchararray is notnull.isNotSameAs(char[] expected) Verifies that the actualchararray is not the same as the given array.isSameAs(char[] expected) Verifies that the actualchararray 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 actualchararray 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
-
CharArrayAssert
protected CharArrayAssert(char... actual) Creates a newCharArrayAssert.- 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(values).as("Some values").isNotEmpty();- Specified by:
asin classGroupAssert<char[]>- 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.as(String)For example:
assertThat(values).describedAs("Some values").isNotEmpty();- Specified by:
describedAsin classGroupAssert<char[]>- 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(values).as(new BasicDescription("Some values")).isNotEmpty();- Specified by:
asin classGroupAssert<char[]>- 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.as(Description)For example:
assertThat(values).describedAs(new BasicDescription("Some values")).isNotEmpty();- Specified by:
describedAsin classGroupAssert<char[]>- Parameters:
description- the description of the actual value.- Returns:
- this assertion object.
-
contains
Verifies that the actualchararray contains the given values.- Parameters:
values- the values to look for.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualchararray isnull.NullPointerException- if the givenchararray isnull.AssertionError- if the actualchararray does not contain the given values.
-
containsOnly
Verifies that the actualchararray contains the given values only.- Parameters:
values- the values to look for.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualchararray isnull.NullPointerException- if the givenchararray isnull.AssertionError- if the actualchararray does not contain the given objects, or if the actualchararray contains elements other than the ones specified.
-
excludes
Verifies that the actualchararray does not contain the given values.- Parameters:
values- the values the array should exclude.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualchararray isnull.NullPointerException- if the givenchararray isnull.AssertionError- if the actualchararray contains any of the given values.
-
satisfies
Verifies that the actualchararray satisfies the given condition.- Specified by:
satisfiesin classGenericAssert<char[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualchararray does not satisfy the given condition.- See Also:
-
doesNotSatisfy
Verifies that the actualchararray does not satisfy the given condition.- Specified by:
doesNotSatisfyin classGenericAssert<char[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualchararray satisfies the given condition.- See Also:
-
is
Alias for.satisfies(Condition)- Specified by:
isin classGenericAssert<char[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualchararray does not satisfy the given condition.- Since:
- 1.2
-
isNot
Alias for.doesNotSatisfy(Condition)- Specified by:
isNotin classGenericAssert<char[]>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualchararray satisfies the given condition.- Since:
- 1.2
-
isNotNull
Verifies that the actualchararray is notnull.- Specified by:
isNotNullin classGenericAssert<char[]>- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualchararray isnull.
-
isNotEmpty
Verifies that the actualchararray contains at least on element.- Specified by:
isNotEmptyin classGroupAssert<char[]>- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualchararray isnull.AssertionError- if the actualchararray is empty.
-
isEqualTo
Verifies that the actualchararray is equal to the given array. Array equality is checked by.Arrays.equals(char[], char[])- Specified by:
isEqualToin classGenericAssert<char[]>- Parameters:
expected- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualchararray is not equal to the given one.
-
isNotEqualTo
Verifies that the actualchararray is not equal to the given array. Array equality is checked by.Arrays.equals(char[], char[])- Specified by:
isNotEqualToin classGenericAssert<char[]>- Parameters:
array- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualchararray is equal to the given one.
-
hasSize
Verifies that the number of elements in the actualchararray is equal to the given one.- Specified by:
hasSizein classGroupAssert<char[]>- Parameters:
expected- the expected number of elements in the actualchararray.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualchararray isnull.AssertionError- if the number of elements in the actualchararray is not equal to the given one.
-
isSameAs
Verifies that the actualchararray is the same as the given array.- Specified by:
isSameAsin classGenericAssert<char[]>- Parameters:
expected- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualchararray is not the same as the given one.
-
isNotSameAs
Verifies that the actualchararray is not the same as the given array.- Specified by:
isNotSameAsin classGenericAssert<char[]>- Parameters:
expected- the given array to compare the actual array to.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualchararray 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<char[]>- Parameters:
message- the given error message, which will replace the default one.- Returns:
- this assertion.
-