21
21
22
22
import static java .util .Arrays .asList ;
23
23
import static java .util .Collections .*;
24
+
25
+ import com .fasterxml .jackson .databind .ObjectMapper ;
24
26
import org .junit .Test ;
25
27
26
28
import static org .springframework .core .ResolvableType .forClass ;
@@ -163,10 +165,10 @@ public void decodeEmptyBodyToMono() throws Exception {
163
165
164
166
@ Test
165
167
public void invalidData () throws Exception {
166
- Flux <DataBuffer > source = Flux .just (stringBuffer ( "{\" property1 \" :\" foo \" " ));
167
- ResolvableType elementType = forClass (BeanWithNoDefaultConstructor .class );
168
- Flux <Object > flux = new Jackson2JsonDecoder ().decode (source , elementType , null , emptyMap ());
169
- StepVerifier .create (flux ).expectError ( InternalCodecException . class );
168
+ Flux <DataBuffer > source = Flux .just (stringBuffer ( "{\" foofoo \" : \" foofoo \" , \" barbar \" : \" barbar \" } " ));
169
+ ResolvableType elementType = forClass (Pojo .class );
170
+ Flux <Object > flux = new Jackson2JsonDecoder (new ObjectMapper () ).decode (source , elementType , null , emptyMap ());
171
+ StepVerifier .create (flux ).verifyErrorMatches ( ex -> ex instanceof CodecException && !( ex instanceof InternalCodecException ) );
170
172
}
171
173
172
174
@ Test
@@ -176,7 +178,7 @@ public void noDefaultConstructor() throws Exception {
176
178
Flux <Object > flux = new Jackson2JsonDecoder ().decode (source , elementType , null , emptyMap ());
177
179
StepVerifier
178
180
.create (flux )
179
- .verifyErrorMatches ( ex -> ex instanceof CodecException && !( ex instanceof InternalCodecException ) );
181
+ .expectError ( InternalCodecException . class );
180
182
}
181
183
182
184
0 commit comments