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
1 parent
49d9f16
commit db5aea3
Showing
4 changed files
with
46 additions
and
34 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
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
34 changes: 34 additions & 0 deletions
34
src/test/java/com/fasterxml/jackson/databind/convert/ScalarConversionTest.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,34 @@ | |||
package com.fasterxml.jackson.databind.convert; | |||
|
|||
import com.fasterxml.jackson.databind.*; | |||
|
|||
public class ScalarConversionTest extends BaseMapTest | |||
{ | |||
private final ObjectMapper MAPPER = new ObjectMapper(); | |||
|
|||
// [databind#1433] | |||
public void testConvertValueNullPrimitive() throws Exception | |||
{ | |||
assertEquals(Byte.valueOf((byte) 0), MAPPER.convertValue(null, Byte.TYPE)); | |||
assertEquals(Short.valueOf((short) 0), MAPPER.convertValue(null, Short.TYPE)); | |||
assertEquals(Integer.valueOf(0), MAPPER.convertValue(null, Integer.TYPE)); | |||
assertEquals(Long.valueOf(0L), MAPPER.convertValue(null, Long.TYPE)); | |||
assertEquals(Float.valueOf(0f), MAPPER.convertValue(null, Float.TYPE)); | |||
assertEquals(Double.valueOf(0d), MAPPER.convertValue(null, Double.TYPE)); | |||
assertEquals(Character.valueOf('\0'), MAPPER.convertValue(null, Character.TYPE)); | |||
assertEquals(Boolean.FALSE, MAPPER.convertValue(null, Boolean.TYPE)); | |||
} | |||
|
|||
// [databind#1433] | |||
public void testConvertValueNullBoxed() throws Exception | |||
{ | |||
assertNull(MAPPER.convertValue(null, Byte.class)); | |||
assertNull(MAPPER.convertValue(null, Short.class)); | |||
assertNull(MAPPER.convertValue(null, Integer.class)); | |||
assertNull(MAPPER.convertValue(null, Long.class)); | |||
assertNull(MAPPER.convertValue(null, Float.class)); | |||
assertNull(MAPPER.convertValue(null, Double.class)); | |||
assertNull(MAPPER.convertValue(null, Character.class)); | |||
assertNull(MAPPER.convertValue(null, Boolean.class)); | |||
} | |||
} |
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