java.lang.Object
io.cucumber.jsonformatter.MessagesToJsonWriter
- All Implemented Interfaces:
AutoCloseable
Writes the message output of a test run as single json report.
Note: Messages are first collected and only written once the stream is closed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final OutputStreamWriterprivate final io.cucumber.query.Queryprivate final io.cucumber.query.Repositoryprivate final MessagesToJsonWriter.Serializerprivate boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMessagesToJsonWriter(OutputStream out, MessagesToJsonWriter.Serializer serializer, Function<URI, String> uriFormatter) -
Method Summary
Modifier and TypeMethodDescriptionstatic MessagesToJsonWriter.Builderbuilder(MessagesToJsonWriter.Serializer serializer) voidclose()Closes the stream, flushing it first.voidwrite(io.cucumber.messages.types.Envelope envelope) Writes a cucumber message to the xml output.
-
Field Details
-
out
-
repository
private final io.cucumber.query.Repository repository -
query
private final io.cucumber.query.Query query -
serializer
-
uriFormatter
-
streamClosed
private boolean streamClosed
-
-
Constructor Details
-
MessagesToJsonWriter
private MessagesToJsonWriter(OutputStream out, MessagesToJsonWriter.Serializer serializer, Function<URI, String> uriFormatter)
-
-
Method Details
-
builder
-
write
Writes a cucumber message to the xml output.- Parameters:
envelope- the message- Throws:
IOException- if an IO error occurs
-
close
Closes the stream, flushing it first. Once closed further write() invocations will cause an IOException to be thrown. Closing a closed stream has no effect.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- if an IO error occurs
-