Top Description Fields Constructors Methods
org.assertj.core.api

public abstract Class AbstractCharacterAssert<SELF extends AbstractCharacterAssert<SELF>>

extends AbstractComparableAssert<SELF extends AbstractCharacterAssert<SELF>, Character>
Class Inheritance
Known Direct Subclasses
org.assertj.core.api.CharacterAssert
Type Parameters
<SELF>
the "self" type of this assertion class. Please read "Emulating 'self types' using Java Generics to simplify fluent API implementation" for more details.
Imports
java.util.Comparator, org.assertj.core.internal.Characters, .ComparatorBasedComparisonStrategy, org.assertj.core.util.CheckReturnValue, .VisibleForTesting

Base class for all implementations of assertions for Characters.
Authors
Yvonne Wang, David DIDIER, Ansgar Konermann, Alex Ruiz, Joel Costigliola, Mikhail Mazursky

Field Summary

Modifier and TypeField and Description
pack-priv Characters
Inherited from org.assertj.core.api.AbstractComparableAssert:
comparables

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public SELF

Returns:

this assertion object.
inUnicode
()

Use unicode character representation instead of standard representation in error messages.

public SELF

Returns:

this assertion object.
isEqualTo
(char
the given value to compare the actual value to.
expected
)

Verifies that the actual value is equal to the given one.

public SELF

Returns:

this assertion object.
isGreaterThan
(char
the given value to compare the actual value to.
other
)

Overrides org.assertj.core.api.AbstractComparableAssert.isGreaterThan.

Implements org.assertj.core.api.ComparableAssert.isGreaterThan.

Verifies that the actual value is greater than the given one.
public SELF

Returns:

this assertion object.
isGreaterThanOrEqualTo
(char
the given value to compare the actual value to.
other
)

Overrides org.assertj.core.api.AbstractComparableAssert.isGreaterThanOrEqualTo.

Implements org.assertj.core.api.ComparableAssert.isGreaterThanOrEqualTo.

Verifies that the actual value is greater than or equal to the given one.
public SELF

Returns:

this assertion object.
isLessThan
(char
the given value to compare the actual value to.
other
)

Overrides org.assertj.core.api.AbstractComparableAssert.isLessThan.

Implements org.assertj.core.api.ComparableAssert.isLessThan.

Verifies that the actual value is less than the given one.
public SELF

Returns:

this assertion object.
isLessThanOrEqualTo
(char
the given value to compare the actual value to.
other
)

Overrides org.assertj.core.api.AbstractComparableAssert.isLessThanOrEqualTo.

Implements org.assertj.core.api.ComparableAssert.isLessThanOrEqualTo.

Verifies that the actual value is less than or equal to the given one.
public SELF

Returns:

this assertion object.
isLowerCase
()

Verifies that the actual value is a lowercase character.

public SELF

Returns:

this assertion object.
isNotEqualTo
(char
the given value to compare the actual value to.
other
)

Verifies that the actual value is not equal to the given one.

public SELF

Returns:

this assertion object.
isUpperCase
()

Verifies that the actual value is a uppercase character.

public SELF
usingComparator(Comparator<? super Character>
the comparator to use for the incoming assertion checks.
customComparator
)

Overrides org.assertj.core.api.AbstractComparableAssert.usingComparator.

Implements org.assertj.core.api.Assert.usingComparator.

Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.
public SELF
usingComparator(Comparator<? super Character>
the comparator to use for the incoming assertion checks.
customComparator
,
String
comparator description to be used in assertion error messages
customComparatorDescription
)

Overrides org.assertj.core.api.AbstractComparableAssert.usingComparator.

Implements org.assertj.core.api.Assert.usingComparator.

Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.
public SELF
Inherited from org.assertj.core.api.AbstractComparableAssert:
inBinaryinHexadecimalisBetweenisEqualByComparingToisNotEqualByComparingToisStrictlyBetween

Field Detail

charactersback to summary
pack-priv Characters characters
Annotations
@VisibleForTesting

Constructor Detail

AbstractCharacterAssertback to summary
protected AbstractCharacterAssert(Character actual, Class<?> selfType)

Method Detail

inUnicodeback to summary
public SELF inUnicode()

Use unicode character representation instead of standard representation in error messages.

It can be useful when comparing UNICODE characters - many unicode chars have duplicate characters assigned, it is thus impossible to find differences from the standard error message:

With standard error message:

 assertThat('µ').isEqualTo('μ');

org.junit.ComparisonFailure:
Expected :'μ'
Actual   :'µ'
With unicode based error message:
 assertThat('µ').inUnicode().isEqualTo('μ');

org.junit.ComparisonFailure:
Expected :μ
Actual   :µ
Returns:SELF

this assertion object.

Annotations
@CheckReturnValue
isEqualToback to summary
public SELF isEqualTo(char expected)

Verifies that the actual value is equal to the given one.

Example:

 // assertion will pass
assertThat('a').isEqualTo('a');

// assertions will fail
assertThat('a').isEqualTo('b');
assertThat('a').isEqualTo('A');
Parameters
expected:char

the given value to compare the actual value to.

Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if the actual value is null.
  • if the actual value is not equal to the given one.
isGreaterThanback to summary
public SELF isGreaterThan(char other)

Overrides org.assertj.core.api.AbstractComparableAssert.isGreaterThan.

Implements org.assertj.core.api.ComparableAssert.isGreaterThan.

Verifies that the actual value is greater than the given one.

Example:

 // assertions will pass
assertThat('a').isGreaterThan('A');
assertThat('b').isGreaterThan('a');

// assertions will fail
assertThat('A').isGreaterThan('a');
assertThat('a').isGreaterThan('b');
assertThat('a').isGreaterThan('a');
Parameters
other:char

the given value to compare the actual value to.

Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if the actual value is null.
  • if the actual value is equal to or less than the given one.
isGreaterThanOrEqualToback to summary
public SELF isGreaterThanOrEqualTo(char other)

Overrides org.assertj.core.api.AbstractComparableAssert.isGreaterThanOrEqualTo.

Implements org.assertj.core.api.ComparableAssert.isGreaterThanOrEqualTo.

Verifies that the actual value is greater than or equal to the given one.

Example:

 // assertions will pass
assertThat('A').isGreaterThanOrEqualTo('A');
assertThat('b').isGreaterThanOrEqualTo('a');

// assertion will fail
assertThat('a').isGreaterThanOrEqualTo('b');
Parameters
other:char

the given value to compare the actual value to.

Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if the actual value is null.
  • if the actual value is less than the given one.
isLessThanback to summary
public SELF isLessThan(char other)

Overrides org.assertj.core.api.AbstractComparableAssert.isLessThan.

Implements org.assertj.core.api.ComparableAssert.isLessThan.

Verifies that the actual value is less than the given one.

Example:

 // assertions will pass
assertThat('A').isLessThan('a');
assertThat('a').isLessThan('b');

// assertions will fail
assertThat('a').isLessThan('A');
assertThat('b').isLessThan('a');
assertThat('a').isLessThan('a');
Parameters
other:char

the given value to compare the actual value to.

Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if the actual value is null.
  • if the actual value is equal to or greater than the given one.
isLessThanOrEqualToback to summary
public SELF isLessThanOrEqualTo(char other)

Overrides org.assertj.core.api.AbstractComparableAssert.isLessThanOrEqualTo.

Implements org.assertj.core.api.ComparableAssert.isLessThanOrEqualTo.

Verifies that the actual value is less than or equal to the given one.

Example:

 // assertions will pass
assertThat('A').isLessThanOrEqualTo('a');
assertThat('A').isLessThanOrEqualTo('A');

// assertion will fail
assertThat('b').isLessThanOrEqualTo('a');
Parameters
other:char

the given value to compare the actual value to.

Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if the actual value is null.
  • if the actual value is greater than the given one.
isLowerCaseback to summary
public SELF isLowerCase()

Verifies that the actual value is a lowercase character.

Example:

 // assertion will pass
assertThat('a').isLowerCase();

// assertions will fail
assertThat('A').isLowerCase();
assertThat(' ').isLowerCase();
assertThat('.').isLowerCase();
assertThat('1').isLowerCase();
Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if the actual value is null.
  • if the actual value is not a lowercase character.
isNotEqualToback to summary
public SELF isNotEqualTo(char other)

Verifies that the actual value is not equal to the given one.

Example:

 // assertions will pass
assertThat('a').isNotEqualTo('b');
assertThat('a').isNotEqualTo('A');

// assertion will fail
assertThat('a').isNotEqualTo('a');
Parameters
other:char

the given value to compare the actual value to.

Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if the actual value is null.
  • if the actual value is equal to the given one.
isUpperCaseback to summary
public SELF isUpperCase()

Verifies that the actual value is a uppercase character.

Example:

 // assertion will pass
assertThat('A').isUpperCase();

// assertions will fail
assertThat('a').isUpperCase();
assertThat(' ').isUpperCase();
assertThat('.').isUpperCase();
assertThat('1').isUpperCase();
Returns:SELF

this assertion object.

Exceptions
AssertionError:
  • if the actual value is null.
  • if the actual value is not a uppercase character.
usingComparatorback to summary
public SELF usingComparator(Comparator<? super Character> customComparator)

Overrides org.assertj.core.api.AbstractComparableAssert.usingComparator.

Implements org.assertj.core.api.Assert.usingComparator.

Doc from org.assertj.core.api.AbstractAssert.usingComparator.

Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.

The custom comparator is bound to assertion instance, meaning that if a new assertion instance is created, the default comparison strategy will be used.

Examples :

 // frodo and sam are instances of Character with Hobbit race (obviously :).
// raceComparator implements Comparator<Character>
assertThat(frodo).usingComparator(raceComparator).isEqualTo(sam);
Parameters
customComparator:Comparator<? super Character>

Doc from org.assertj.core.api.Assert.usingComparator.

the comparator to use for the incoming assertion checks.

Returns:SELF

Doc from org.assertj.core.api.Assert.usingComparator.

this assertion object.

Annotations
@Override
@CheckReturnValue
usingComparatorback to summary
public SELF usingComparator(Comparator<? super Character> customComparator, String customComparatorDescription)

Overrides org.assertj.core.api.AbstractComparableAssert.usingComparator.

Implements org.assertj.core.api.Assert.usingComparator.

Doc from org.assertj.core.api.AbstractAssert.usingComparator.

Use the given custom comparator instead of relying on actual type A equals method for incoming assertion checks.

The custom comparator is bound to assertion instance, meaning that if a new assertion instance is created, the default comparison strategy will be used.

Examples :

 // frodo and sam are instances of Character with Hobbit race (obviously :).
// raceComparator implements Comparator<Character>
assertThat(frodo).usingComparator(raceComparator, "Hobbit Race Comparator").isEqualTo(sam);
Parameters
customComparator:Comparator<? super Character>

Doc from org.assertj.core.api.Assert.usingComparator.

the comparator to use for the incoming assertion checks.

customComparatorDescription:String

Doc from org.assertj.core.api.Assert.usingComparator.

comparator description to be used in assertion error messages

Returns:SELF

Doc from org.assertj.core.api.Assert.usingComparator.

this assertion object.

Annotations
@Override
@CheckReturnValue
usingDefaultComparatorback to summary
public SELF usingDefaultComparator()

Overrides org.assertj.core.api.AbstractComparableAssert.usingDefaultComparator.

Implements org.assertj.core.api.Assert.usingDefaultComparator.

Doc from org.assertj.core.api.AbstractAssert.usingDefaultComparator.

Revert to standard comparison for the incoming assertion checks.

This method should be used to disable a custom comparison strategy set by calling usingComparator.

Returns:SELF

Doc from org.assertj.core.api.Assert.usingDefaultComparator.

this assertion object.

Annotations
@Override
@CheckReturnValue