Package org.fest.assertions
Class CharAssert
Understands assertion methods for
Characters and chars. To create a new instance of this class call
Assertions.assertThat(Character) or Assertions.assertThat(char).-
Field Summary
Fields inherited from class org.fest.assertions.GenericAssert
actual -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCharAssert(char actual) Creates a new.CharAssertprotectedCharAssert(Character actual) Creates a new.CharAssert -
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<Character> condition) Verifies that the actualdoes not satisfy the given condition.CharacterAlias for.satisfies(Condition)isEqualTo(char expected) Verifies that theCharactervalue is equal to the given one.Verifies that the actualvalue is equal to the given one.CharacterisGreaterThan(char other) Verifies that theCharactervalue is greater than the given one.isGreaterThanOrEqualTo(char other) Verifies that theCharactervalue is greater or equal to the given one.isLessThan(char other) Verifies that theCharactervalue is less than the given one.isLessThanOrEqualTo(char other) Verifies that theCharactervalue is less or equal to the given one.Verifies that theCharactervalue is an lower-case value.Alias for.doesNotSatisfy(Condition)isNotEqualTo(char other) Verifies that theCharactervalue is not equal to the given one.isNotEqualTo(Character other) Verifies that the actualis not equal to the given one.CharacterVerifies that the actualis notCharacternull.isNotSameAs(Character other) Verifies that the actualis not the same object as the given one.CharacterVerifies that the actualis the same object as the given one.CharacterVerifies that theCharactervalue is an upper-case value.overridingErrorMessage(String message) Replaces the default message displayed in case of a failure with the given one.Verifies that the actualsatisfies the given condition.CharacterMethods 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
-
CharAssert
protected CharAssert(char actual) Creates a new.CharAssert- Parameters:
actual- the actual value to verify.
-
CharAssert
Creates a new.CharAssert- 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<Character>- 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<Character>- 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<Character>- 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<Character>- Parameters:
description- the description of the actual value.- Returns:
- this assertion object.
-
isEqualTo
Verifies that theCharactervalue is equal to the given one.- Parameters:
expected- the value to compare the actual one to.- Returns:
- this assertion object.
- Throws:
AssertionError- if theCharactervalue is not equal to the given one.
-
isEqualTo
Verifies that the actualvalue is equal to the given one.Character- Specified by:
isEqualToin classGenericAssert<Character>- Parameters:
expected- the givenCharactervalue to compare the actualCharacterto.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualCharactervalue is not equal to the given one.- Since:
- 1.3
-
isNotEqualTo
Verifies that theCharactervalue is not equal to the given one.- Parameters:
other- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError- if theCharactervalue is equal to the given one.
-
isNotEqualTo
Verifies that the actualis not equal to the given one.Character- Specified by:
isNotEqualToin classGenericAssert<Character>- Parameters:
other- the givenCharacterto compare the actualCharacterto.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualCharactervalue is equal to the given one.- Since:
- 1.3
-
isGreaterThan
Verifies that theCharactervalue is greater than the given one.- Parameters:
other- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError- if theCharactervalue is not greater than the given one.
-
isLessThan
Verifies that theCharactervalue is less than the given one.- Parameters:
other- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError- if theCharactervalue is not less than the given one.
-
isGreaterThanOrEqualTo
Verifies that theCharactervalue is greater or equal to the given one.- Parameters:
other- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError- if theCharactervalue is not greater than or equal to the given one.
-
isLessThanOrEqualTo
Verifies that theCharactervalue is less or equal to the given one.- Parameters:
other- the given value.- Returns:
- this assertion object.
- Throws:
AssertionError- if theCharactervalue is not less than or equal to the given one.
-
isUpperCase
Verifies that theCharactervalue is an upper-case value.- Returns:
- this assertion object.
- Throws:
AssertionError- if theCharactervalue is not an upper-case value.
-
isLowerCase
Verifies that theCharactervalue is an lower-case value.- Returns:
- this assertion object.
- Throws:
AssertionError- if theCharactervalue is not an lower-case value.
-
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<Character>- Parameters:
message- the given error message, which will replace the default one.- Returns:
- this assertion.
-
satisfies
Verifies that the actualsatisfies the given condition.Character- Specified by:
satisfiesin classGenericAssert<Character>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualCharacterdoes not satisfy the given condition.- Since:
- 1.3
- See Also:
-
doesNotSatisfy
Verifies that the actualdoes not satisfy the given condition.Character- Specified by:
doesNotSatisfyin classGenericAssert<Character>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualCharacterdoes satisfies the given condition.- Since:
- 1.3
- See Also:
-
is
Alias for.satisfies(Condition)- Specified by:
isin classGenericAssert<Character>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualCharacterdoes not satisfy the given condition.- Since:
- 1.3
-
isNot
Alias for.doesNotSatisfy(Condition)- Specified by:
isNotin classGenericAssert<Character>- Parameters:
condition- the given condition.- Returns:
- this assertion object.
- Throws:
NullPointerException- if the given condition isnull.AssertionError- if the actualCharacterdoes not satisfy the given condition.- Since:
- 1.3
-
isNotNull
Verifies that the actualis notCharacternull.- Specified by:
isNotNullin classGenericAssert<Character>- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualCharactervalue isnull.- Since:
- 1.3
-
isSameAs
Verifies that the actualis the same object as the given one.Character- Specified by:
isSameAsin classGenericAssert<Character>- Parameters:
expected- the givenCharacterto compare the actualCharacterto.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualCharactervalue is not the same as the given one.- Since:
- 1.3
-
isNotSameAs
Verifies that the actualis not the same object as the given one.Character- Specified by:
isNotSameAsin classGenericAssert<Character>- Parameters:
other- the givenCharacterto compare the actualBigDecimalto.- Returns:
- this assertion object.
- Throws:
AssertionError- if the actualCharactervalue is the same as the given one.- Since:
- 1.3
-