Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Commit f04699d

Browse files
committed
Add the (failing) test for #64
1 parent 47793f0 commit f04699d

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

pom.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Guava (http://code.google.com/p/guava-libraries/) types (currently mostly just c
2929
</contributors>
3030

3131
<properties>
32-
<version.jackson>2.5.2</version.jackson>
32+
<version.jackson>2.5.3-SNAPSHOT</version.jackson>
3333

3434
<!-- Generate PackageVersion.java into this directory. -->
3535
<packageVersion.dir>com/fasterxml/jackson/datatype/guava</packageVersion.dir>
@@ -89,6 +89,15 @@ com.fasterxml.jackson.databind.util
8989
</execution>
9090
</executions>
9191
</plugin>
92+
<plugin>
93+
<groupId>org.apache.maven.plugins</groupId>
94+
<artifactId>maven-surefire-plugin</artifactId>
95+
<configuration>
96+
<excludes>
97+
<exclude>com/fasterxml/jackson/**/failing/*.java</exclude>
98+
</excludes>
99+
</configuration>
100+
</plugin>
92101
</plugins>
93102
</build>
94103
</project>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.fasterxml.jackson.datatype.guava.failing;
2+
3+
import com.fasterxml.jackson.annotation.*;
4+
5+
import com.fasterxml.jackson.databind.*;
6+
7+
import com.fasterxml.jackson.datatype.guava.ModuleTestBase;
8+
9+
import com.google.common.base.Optional;
10+
11+
/**
12+
* Unit test for #64.
13+
*/
14+
public class OptionalUnwrappedTest extends ModuleTestBase
15+
{
16+
static class Child {
17+
public String name = "Bob";
18+
}
19+
20+
static class Parent {
21+
private Child child = new Child();
22+
23+
@JsonUnwrapped
24+
public Child getChild() { return child; }
25+
}
26+
27+
static class OptionalParent {
28+
@JsonUnwrapped
29+
public Optional<Child> child = Optional.of(new Child());
30+
}
31+
32+
private final ObjectMapper MAPPER = mapperWithModule();
33+
34+
public void testUntyped() throws Exception
35+
{
36+
ObjectWriter w = MAPPER.writerWithDefaultPrettyPrinter();
37+
// String jsonExp = w.writeValueAsString(new Parent());
38+
String jsonExp = aposToQuotes("{\n 'name' : 'Bob'\n}");
39+
String jsonAct = w.writeValueAsString(new OptionalParent());
40+
assertEquals(jsonExp, jsonAct);
41+
}
42+
}

0 commit comments

Comments
 (0)