Fixed structuredToEvent test
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
This commit is contained in:
parent
92c205a941
commit
d207ecc311
|
@ -11,15 +11,25 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
|
||||
public class EventMessageRoundtripTest {
|
||||
|
||||
/**
|
||||
* This test doesn't test extensions in event because the CSVFormat doesn't support it
|
||||
*
|
||||
* @param input
|
||||
*/
|
||||
@ParameterizedTest()
|
||||
@MethodSource("io.cloudevents.test.Data#allEvents")
|
||||
@MethodSource("io.cloudevents.test.Data#allEventsWithoutExtensions")
|
||||
void structuredToEvent(CloudEvent input) {
|
||||
assertThat(input.asStructuredMessage(CSVFormat.INSTANCE).toEvent())
|
||||
.isEqualTo(input);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test doesn't test extensions in event because the CSVFormat doesn't support it
|
||||
*
|
||||
* @param input
|
||||
*/
|
||||
@ParameterizedTest()
|
||||
@MethodSource("io.cloudevents.test.Data#allEvents")
|
||||
@MethodSource("io.cloudevents.test.Data#allEventsWithoutExtensions")
|
||||
void structuredToMockStructuredMessageToEvent(CloudEvent input) {
|
||||
assertThat(input.asStructuredMessage(CSVFormat.INSTANCE).visit(new MockStructuredMessage()).toEvent())
|
||||
.isEqualTo(input);
|
||||
|
|
|
@ -78,6 +78,10 @@ public class Data {
|
|||
return Stream.concat(v1Events(), v03Events());
|
||||
}
|
||||
|
||||
public static Stream<CloudEvent> allEventsWithoutExtensions() {
|
||||
return Stream.concat(v1Events(), v03Events()).filter(e -> e.getExtensions().isEmpty());
|
||||
}
|
||||
|
||||
public static Stream<CloudEvent> v1Events() {
|
||||
return Stream.of(
|
||||
Data.V1_MIN,
|
||||
|
|
Loading…
Reference in New Issue