forked from jdereg/java-util
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
248 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/test/java/com/cedarsoftware/util/convert/CharacterConversionsTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.cedarsoftware.util.convert; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.NullSource; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class CharacterConversionsTests { | ||
|
||
private Converter converter; | ||
|
||
@BeforeEach | ||
void beforeEach() { | ||
this.converter = new Converter(new DefaultConverterOptions()); | ||
} | ||
|
||
@ParameterizedTest | ||
@NullSource | ||
void toByteObject_whenCharacterIsNull_returnsNull(Character ch) { | ||
assertThat(this.converter.convert(ch, Byte.class)) | ||
.isNull(); | ||
} | ||
|
||
@ParameterizedTest | ||
@NullSource | ||
void toByte_whenCharacterIsNull_returnsCommonValuesZero(Character ch) { | ||
assertThat(this.converter.convert(ch, byte.class)) | ||
.isSameAs(CommonValues.BYTE_ZERO); | ||
} | ||
|
||
@ParameterizedTest | ||
@NullSource | ||
void toIntObject_whenCharacterIsNull_returnsNull(Character ch) { | ||
assertThat(this.converter.convert(ch, Integer.class)) | ||
.isNull(); | ||
} | ||
|
||
@ParameterizedTest | ||
@NullSource | ||
void toInteger_whenCharacterIsNull_returnsCommonValuesZero(Character ch) { | ||
assertThat(this.converter.convert(ch, int.class)) | ||
.isSameAs(CommonValues.INTEGER_ZERO); | ||
} | ||
} |
Oops, something went wrong.