use of org.springframework.web.testfixture.xml.Pojo in project spring-framework by spring-projects.
the class Jackson2CborDecoderTests method decodeToMono.
@Override
@Test
public void decodeToMono() {
List<Pojo> expected = Arrays.asList(pojo1, pojo2);
Flux<DataBuffer> input = Flux.just(expected).map(this::writeObject).flatMap(this::dataBuffer);
ResolvableType elementType = ResolvableType.forClassWithGenerics(List.class, Pojo.class);
testDecodeToMono(input, elementType, step -> step.expectNext(expected).expectComplete().verify(), null, null);
}
use of org.springframework.web.testfixture.xml.Pojo in project spring-framework by spring-projects.
the class Jackson2SmileDecoderTests method decodeToMono.
@Override
@Test
public void decodeToMono() {
List<Pojo> expected = Arrays.asList(pojo1, pojo2);
Flux<DataBuffer> input = Flux.just(expected).map(this::writeObject).flatMap(this::dataBuffer);
ResolvableType elementType = ResolvableType.forClassWithGenerics(List.class, Pojo.class);
testDecodeToMono(input, elementType, step -> step.expectNext(expected).expectComplete().verify(), null, null);
}
use of org.springframework.web.testfixture.xml.Pojo in project spring-framework by spring-projects.
the class ServerSentEventHttpMessageWriterTests method writePojoWithPrettyPrint.
// SPR-14899
@ParameterizedDataBufferAllocatingTest
void writePojoWithPrettyPrint(String displayName, DataBufferFactory bufferFactory) {
super.bufferFactory = bufferFactory;
ObjectMapper mapper = Jackson2ObjectMapperBuilder.json().indentOutput(true).build();
this.messageWriter = new ServerSentEventHttpMessageWriter(new Jackson2JsonEncoder(mapper));
MockServerHttpResponse outputMessage = new MockServerHttpResponse(super.bufferFactory);
Flux<Pojo> source = Flux.just(new Pojo("foofoo", "barbar"), new Pojo("foofoofoo", "barbarbar"));
testWrite(source, outputMessage, Pojo.class);
StepVerifier.create(outputMessage.getBody()).consumeNextWith(stringConsumer("data:")).consumeNextWith(stringConsumer("{\n" + "data: \"foo\" : \"foofoo\",\n" + "data: \"bar\" : \"barbar\"\n" + "data:}")).consumeNextWith(stringConsumer("\n\n")).consumeNextWith(stringConsumer("data:")).consumeNextWith(stringConsumer("{\n" + "data: \"foo\" : \"foofoofoo\",\n" + "data: \"bar\" : \"barbarbar\"\n" + "data:}")).consumeNextWith(stringConsumer("\n\n")).expectComplete().verify();
}
use of org.springframework.web.testfixture.xml.Pojo in project spring-framework by spring-projects.
the class Jackson2CborEncoderTests method encode.
@Test
public void encode() {
Pojo value = new Pojo("foo", "bar");
DataBuffer result = encoder.encodeValue(value, this.bufferFactory, ResolvableType.forClass(Pojo.class), CBOR_MIME_TYPE, null);
pojoConsumer(value).accept(result);
}
use of org.springframework.web.testfixture.xml.Pojo in project spring-framework by spring-projects.
the class Jackson2CborEncoderTests method encodeStream.
@Test
public void encodeStream() {
Pojo pojo1 = new Pojo("foo", "bar");
Pojo pojo2 = new Pojo("foofoo", "barbar");
Pojo pojo3 = new Pojo("foofoofoo", "barbarbar");
Flux<Pojo> input = Flux.just(pojo1, pojo2, pojo3);
ResolvableType type = ResolvableType.forClass(Pojo.class);
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> encoder.encode(input, this.bufferFactory, type, CBOR_MIME_TYPE, null));
}
Aggregations