Skip to content

Commit 9a501fa

Browse files
committed
Fix failing tests
Issue: SPR-14925
1 parent e33f603 commit 9a501fa

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

spring-web/src/test/java/org/springframework/http/codec/json/Jackson2JsonDecoderTests.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
import static java.util.Arrays.asList;
2323
import static java.util.Collections.*;
24+
25+
import com.fasterxml.jackson.databind.ObjectMapper;
2426
import org.junit.Test;
2527

2628
import static org.springframework.core.ResolvableType.forClass;
@@ -163,10 +165,10 @@ public void decodeEmptyBodyToMono() throws Exception {
163165

164166
@Test
165167
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));
170172
}
171173

172174
@Test
@@ -176,7 +178,7 @@ public void noDefaultConstructor() throws Exception {
176178
Flux<Object> flux = new Jackson2JsonDecoder().decode(source, elementType, null, emptyMap());
177179
StepVerifier
178180
.create(flux)
179-
.verifyErrorMatches(ex -> ex instanceof CodecException && !(ex instanceof InternalCodecException));
181+
.expectError(InternalCodecException.class);
180182
}
181183

182184

0 commit comments

Comments
 (0)