@@ -21,17 +21,20 @@ static class WithTransient {
21
21
}
22
22
23
23
public static interface PublicView {}
24
- public static interface OtherView {}
24
+ public static interface PrivateView {}
25
25
26
- @ JsonPropertyOrder ({"a " , "b " })
26
+ @ JsonPropertyOrder ({"aaa " , "bbb" , "ccc" , "ddd " })
27
27
static class WithTransientAndView {
28
- public int a = 3 ;
29
-
30
- @ JsonView (PublicView .class )
31
- @ Transient
32
- public int b = 4 ;
28
+ public String aaa = "xxx" ;
29
+ @ Transient
30
+ public String bbb = "xxx" ;
31
+ @ Transient
32
+ @ JsonView (PublicView .class )
33
+ public String ccc = "xxx" ;
34
+ @ JsonView (PrivateView .class )
35
+ public String ddd = "xxx" ;
33
36
}
34
-
37
+
35
38
/*
36
39
/**********************************************************************
37
40
/* Test methods
@@ -55,21 +58,11 @@ public void testSimpleTransient() throws Exception
55
58
public void testTransientWithView () throws Exception
56
59
{
57
60
ObjectMapper mapper = mapperWithModule (false );
58
- assertEquals (aposToQuotes ("{'a':3}" ),
59
- mapper .writerWithView (PublicView .class )
60
- .writeValueAsString (new WithTransientAndView ()));
61
-
62
- Hibernate4Module mod = hibernateModule (false );
63
- mod .disable (Hibernate4Module .Feature .USE_TRANSIENT_ANNOTATION );
64
- mapper = new ObjectMapper ().registerModule (mod );
65
-
66
- assertEquals (aposToQuotes ("{'a':3,'b':4}" ),
61
+ assertEquals (aposToQuotes ("{'aaa':'xxx'}" ),
67
62
mapper .writerWithView (PublicView .class )
68
63
.writeValueAsString (new WithTransientAndView ()));
69
-
70
- // although not if not within view
71
- assertEquals (aposToQuotes ("{'a':3}" ),
72
- mapper .writerWithView (OtherView .class )
64
+ assertEquals (aposToQuotes ("{'aaa':'xxx','ddd':'xxx'}" ),
65
+ mapper .writerWithView (PrivateView .class )
73
66
.writeValueAsString (new WithTransientAndView ()));
74
67
}
75
68
}
0 commit comments