Skip to content

Commit

Permalink
Add a failing test for #1559
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 16, 2017
1 parent 5cdd5ca commit 0cf9c07
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
Expand Up @@ -137,17 +137,15 @@ static class Child {
static class SubChild {
public String value;
}

// // // Reuse mapper to keep tests bit faster

private final ObjectMapper MAPPER = new ObjectMapper();

/*
/**********************************************************
/* Tests, serialization
/**********************************************************
*/

private final ObjectMapper MAPPER = new ObjectMapper();

public void testPrefixedUnwrappingSerialize() throws Exception
{
assertEquals("{\"name\":\"Tatu\",\"_x\":1,\"_y\":2}",
Expand Down
@@ -0,0 +1,32 @@
package com.fasterxml.jackson.failing;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.databind.*;

public class UnwrappedWithView1559Test extends BaseMapTest
{
@JsonInclude(JsonInclude.Include.NON_EMPTY)
static final class Health {
@JsonUnwrapped
public Status status;
}

// NOTE: `final` is required to trigger [databind#1559]
static final class Status {
public String code;
}

/*
/**********************************************************
/* Tests methods
/**********************************************************
*/

// for [databind#1559]
public void testCanSerializeSimpleWithDefaultView() throws Exception {
String json = new ObjectMapper().configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false)
.writeValueAsString(new Health());
assertEquals(aposToQuotes("{'status':null}"), json);
}
}

0 comments on commit 0cf9c07

Please sign in to comment.