11package io .openapitoools .jackson .dataformat .hal .deser ;
22
3+ import static org .junit .jupiter .api .Assertions .assertNotNull ;
4+ import static org .junit .jupiter .api .Assertions .assertNull ;
5+
6+ import java .io .IOException ;
7+ import java .io .StringReader ;
8+
9+ import org .junit .jupiter .api .Test ;
10+
311import com .fasterxml .jackson .annotation .JsonView ;
412import com .fasterxml .jackson .databind .MapperFeature ;
5- import com . fasterxml . jackson . databind . ObjectMapper ;
13+
614import io .openapitools .jackson .dataformat .hal .HALLink ;
715import io .openapitools .jackson .dataformat .hal .HALMapper ;
816import io .openapitools .jackson .dataformat .hal .annotation .EmbeddedResource ;
917import io .openapitools .jackson .dataformat .hal .annotation .Link ;
1018import io .openapitools .jackson .dataformat .hal .annotation .Resource ;
11- import org .junit .jupiter .api .Test ;
12-
13- import java .io .StringReader ;
14- import java .net .URI ;
15-
16- import static org .junit .jupiter .api .Assertions .*;
1719
1820
1921public class HALBeanDeserializerJsonViewIT {
@@ -101,12 +103,12 @@ public class HALBeanDeserializerJsonViewIT {
101103 ",\" stateWithView2\" :\" stateWithView2\" " +
102104 "}" ;
103105
104- ObjectMapper om = new HALMapper ();
105-
106106 @ Test
107- public void testDeserializationOfView () throws Exception {
108- om .configure (MapperFeature .DEFAULT_VIEW_INCLUSION , false );
109- TopResource tr = om .readerWithView (ResourceView1 .class ).readValue (new StringReader (HAL_DOC_VIEW ), TopResource .class );
107+ public void testDeserializationOfView () throws IOException {
108+ TopResource tr = new HALMapper ()
109+ .configure (MapperFeature .DEFAULT_VIEW_INCLUSION , false )
110+ .readerWithView (ResourceView1 .class )
111+ .readValue (new StringReader (HAL_DOC_VIEW ), TopResource .class );
110112
111113 assertNull (tr .childWithoutView );
112114 assertNull (tr .linkWithoutView );
@@ -123,9 +125,11 @@ public void testDeserializationOfView() throws Exception {
123125 }
124126
125127 @ Test
126- public void testDeserializationOfViewWithInclusion () throws Exception {
127- om .configure (MapperFeature .DEFAULT_VIEW_INCLUSION , true );
128- TopResource tr = om .readerWithView (ResourceView1 .class ).readValue (new StringReader (HAL_DOC_INCLUSIVE_VIEW ), TopResource .class );
128+ public void testDeserializationOfViewWithInclusion () throws IOException {
129+ TopResource tr = new HALMapper ()
130+ .configure (MapperFeature .DEFAULT_VIEW_INCLUSION , true )
131+ .readerWithView (ResourceView1 .class )
132+ .readValue (new StringReader (HAL_DOC_INCLUSIVE_VIEW ), TopResource .class );
129133
130134 assertNotNull (tr .childWithoutView );
131135 assertNotNull (tr .linkWithoutView );
@@ -141,8 +145,8 @@ public void testDeserializationOfViewWithInclusion() throws Exception {
141145 }
142146
143147 @ Test
144- public void testDeserializationOfNoView () throws Exception {
145- TopResource tr = om .readValue (new StringReader (HAL_DOC_NO_VIEW ), TopResource .class );
148+ public void testDeserializationOfNoView () throws IOException {
149+ TopResource tr = new HALMapper () .readValue (new StringReader (HAL_DOC_NO_VIEW ), TopResource .class );
146150
147151 assertNotNull (tr .childWithoutView );
148152 assertNotNull (tr .linkWithoutView );
0 commit comments