-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add failing test for #141/blackbird (and similar test, passing, for a…
…fterburner)
- Loading branch information
1 parent
4f55ac1
commit 51a923a
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...c/test/java/com/fasterxml/jackson/module/afterburner/deser/ctor/DoubleArrayDeserTest.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,34 @@ | ||
package com.fasterxml.jackson.module.afterburner.deser.ctor; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.module.afterburner.AfterburnerTestBase; | ||
|
||
// [modules-base#141] | ||
public class DoubleArrayDeserTest extends AfterburnerTestBase | ||
{ | ||
// [modules-base#141] | ||
static class Foo141 { | ||
@JsonProperty("bar") | ||
double[] bar; | ||
|
||
@JsonCreator | ||
public Foo141(@JsonProperty("bar") double... bar) { | ||
this.bar = bar; | ||
} | ||
} | ||
|
||
private final ObjectMapper MAPPER = newAfterburnerMapper(); | ||
|
||
// [modules-base#141] | ||
public void testDoubleArrayViaCreator() throws Exception | ||
{ | ||
Foo141 foo = new Foo141(new double[] { 2.0, 0.25 }); | ||
String serialized = MAPPER.writeValueAsString(foo); | ||
Foo141 foo2 = MAPPER.readValue(serialized, Foo141.class); | ||
|
||
assertEquals(2, foo2.bar.length); | ||
assertEquals(0.25, foo2.bar[1]); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...src/test/java/com/fasterxml/jackson/module/blackbird/failing/DoubleArrayDeser141Test.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,35 @@ | ||
package com.fasterxml.jackson.module.blackbird.failing; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.module.blackbird.BlackbirdTestBase; | ||
|
||
// [modules-base#141] | ||
public class DoubleArrayDeser141Test extends BlackbirdTestBase | ||
{ | ||
// [modules-base#141] | ||
static class Foo141 { | ||
@JsonProperty("bar") | ||
double[] bar; | ||
|
||
@JsonCreator | ||
public Foo141(@JsonProperty("bar") double... bar) { | ||
this.bar = bar; | ||
} | ||
} | ||
|
||
private final ObjectMapper MAPPER = newObjectMapper(); | ||
|
||
// [modules-base#141] | ||
public void testDoubleArrayViaCreator() throws Exception | ||
{ | ||
Foo141 foo = new Foo141(new double[] { 2.0, 0.25 }); | ||
String serialized = MAPPER.writeValueAsString(foo); | ||
Foo141 foo2 = MAPPER.readValue(serialized, Foo141.class); | ||
|
||
assertEquals(2, foo2.bar.length); | ||
assertEquals(0.25, foo2.bar[1]); | ||
} | ||
} |