Skip to content

Commit e2ebe83

Browse files
committed
add a (failing) test for #507
1 parent dabf4b5 commit e2ebe83

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.fasterxml.jackson.failing;
2+
3+
import java.io.IOException;
4+
5+
import com.fasterxml.jackson.annotation.*;
6+
7+
import com.fasterxml.jackson.databind.*;
8+
9+
public class DefaultView507Test extends BaseMapTest
10+
{
11+
// Classes that represent views
12+
static class ViewA { }
13+
static class ViewAA extends ViewA { }
14+
static class ViewB { }
15+
static class ViewBB extends ViewB { }
16+
17+
@JsonView(ViewA.class)
18+
@JsonPropertyOrder({ "a", "b" })
19+
static class Defaulting {
20+
public int a = 3;
21+
22+
@JsonView(ViewB.class)
23+
public int b = 5;
24+
}
25+
26+
/*
27+
/**********************************************************
28+
/* Unit tests
29+
/**********************************************************
30+
*/
31+
32+
private final ObjectMapper MAPPER = new ObjectMapper();
33+
34+
public void testSimple() throws IOException
35+
{
36+
assertEquals(aposToQuotes("{'a':3}"),
37+
MAPPER.writerWithView(ViewA.class)
38+
.writeValueAsString(new Defaulting()));
39+
assertEquals(aposToQuotes("{'b':5}"),
40+
MAPPER.writerWithView(ViewB.class)
41+
.writeValueAsString(new Defaulting()));
42+
}
43+
}

0 commit comments

Comments
 (0)