Skip to content

Commit 47825fe

Browse files
committed
Comment out tests for #68, need to figure out rules wrt empty value to null handling
1 parent d14fc9a commit 47825fe

File tree

3 files changed

+45
-41
lines changed

3 files changed

+45
-41
lines changed

datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/deser/ZoneIdDeserTest.java

+23-19
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.time.ZoneId;
44
import java.util.Map;
55

6+
import org.junit.Ignore;
67
import org.junit.Test;
78

89
import com.fasterxml.jackson.databind.*;
@@ -39,25 +40,6 @@ public void testSimpleZoneIdDeser() throws Exception
3940
MAPPER.readValue("\"America/Anchorage\"", ZoneId.class));
4041
}
4142

42-
@Test
43-
public void testZoneOffsetDeserFromEmpty() throws Exception
44-
{
45-
// by default, should be fine
46-
assertNull(MAPPER.readValue(quote(" "), ZoneId.class));
47-
// but fail if coercion illegal
48-
try {
49-
newMapperBuilder()
50-
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
51-
.build()
52-
.readValue(quote(" "), ZoneId.class);
53-
fail("Should not pass");
54-
} catch (MismatchedInputException e) {
55-
verifyException(e, "Cannot coerce");
56-
verifyException(e, ZoneId.class.getName());
57-
verifyException(e, "enable `MapperFeature.ALLOW_COERCION_OF_SCALARS`");
58-
}
59-
}
60-
6143
@Test
6244
public void testPolymorphicZoneIdDeser() throws Exception
6345
{
@@ -131,4 +113,26 @@ public void testStrictDeserializeFromEmptyString() throws Exception {
131113
String valueFromEmptyStr = mapper.writeValueAsString(asMap(key, ""));
132114
objectReader.readValue(valueFromEmptyStr);
133115
}
116+
117+
// [module-java8#68]: Was to prevent it but... conflicts with [#138]
118+
@Ignore
119+
@Test
120+
public void testZoneOffsetDeserFromEmpty() throws Exception
121+
{
122+
// by default, should be fine
123+
assertNull(MAPPER.readValue(quote(" "), ZoneId.class));
124+
// but fail if coercion illegal
125+
try {
126+
newMapperBuilder()
127+
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
128+
.build()
129+
.readValue(quote(" "), ZoneId.class);
130+
fail("Should not pass");
131+
} catch (MismatchedInputException e) {
132+
verifyException(e, "Cannot coerce");
133+
verifyException(e, ZoneId.class.getName());
134+
verifyException(e, "enable `MapperFeature.ALLOW_COERCION_OF_SCALARS`");
135+
}
136+
}
137+
134138
}

datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/deser/ZoneOffsetDeserTest.java

+22-20
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import com.fasterxml.jackson.datatype.jsr310.MockObjectConfiguration;
3737
import com.fasterxml.jackson.datatype.jsr310.ModuleTestBase;
3838

39+
import org.junit.Ignore;
3940
import org.junit.Test;
4041

4142
public class ZoneOffsetDeserTest extends ModuleTestBase
@@ -55,26 +56,6 @@ public void testSimpleZoneOffsetDeser() throws Exception
5556
READER.readValue("\"-06:30\""));
5657
}
5758

58-
@Test
59-
public void testZoneOffsetDeserFromEmpty() throws Exception
60-
{
61-
// by default, should be fine
62-
assertNull(MAPPER.readValue(quote(" "), ZoneOffset.class));
63-
// but fail if coercion illegal
64-
try {
65-
newMapperBuilder()
66-
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
67-
.build()
68-
.readerFor(ZoneOffset.class)
69-
.readValue(quote(" "));
70-
fail("Should not pass");
71-
} catch (MismatchedInputException e) {
72-
verifyException(e, "Cannot coerce");
73-
verifyException(e, ZoneOffset.class.getName());
74-
verifyException(e, "enable `MapperFeature.ALLOW_COERCION_OF_SCALARS`");
75-
}
76-
}
77-
7859
@Test
7960
public void testPolymorphicZoneOffsetDeser() throws Exception
8061
{
@@ -201,4 +182,25 @@ public void testStrictDeserializeFromEmptyString() throws Exception {
201182
objectReader.readValue(valueFromEmptyStr);
202183
}
203184

185+
// [module-java8#68]: Was to prevent it but... conflicts with [#138]
186+
@Ignore
187+
@Test
188+
public void testZoneOffsetDeserFromEmpty() throws Exception
189+
{
190+
// by default, should be fine
191+
assertNull(MAPPER.readValue(quote(" "), ZoneOffset.class));
192+
// but fail if coercion illegal
193+
try {
194+
newMapperBuilder()
195+
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
196+
.build()
197+
.readerFor(ZoneOffset.class)
198+
.readValue(quote(" "));
199+
fail("Should not pass");
200+
} catch (MismatchedInputException e) {
201+
verifyException(e, "Cannot coerce");
202+
verifyException(e, ZoneOffset.class.getName());
203+
verifyException(e, "enable `MapperFeature.ALLOW_COERCION_OF_SCALARS`");
204+
}
205+
}
204206
}

release-notes/VERSION

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ due to number of types.
1515

1616
3.0.0 (not yet released)
1717

18-
#68: Parsing of `ZoneId` should respect `ALLOW_COERCION_OF_SCALARS`
19-
wrt empty String
2018
- Deprecate "paramater names" and "datatypes" modules as functionality
2119
now included directly in `jackson-databind`
2220
- Remove legacy `JSR310Module`

0 commit comments

Comments
 (0)