T - interface type whose methods are recorded and verifiedpublic class BytesTextMethodTester<T> extends Object
Bytes using a textual description of the
method calls. The input file typically contains a hex dump with optional comments describing
the invocations. These calls are dispatched to a component supplied by componentFunction
and the resulting output is serialised to text and compared with the expected output file.
It is a convenient way to perform data driven tests of writer/reader style APIs.| Constructor and Description |
|---|
BytesTextMethodTester(String input,
Function<T,Object> componentFunction,
Class<T> outputClass,
String output)
Creates a tester configured with the given files and component builder.
|
| Modifier and Type | Method and Description |
|---|---|
String |
actual()
Returns the text generated from running the component under test.
|
Function<String,String> |
afterRun()
Returns the post-processing function applied to actual and expected output.
|
@NotNull BytesTextMethodTester |
afterRun(UnaryOperator<String> afterRun)
Sets a post-processing function applied to both expected and actual output before comparison.
|
String |
expected()
Returns the contents of the expected output file after optional post-processing.
|
@NotNull BytesTextMethodTester |
run()
Executes the test.
|
String |
setup()
Returns the path to the optional setup file.
|
@NotNull BytesTextMethodTester |
setup(String setup)
Sets a setup file to be processed before the main input.
|
public BytesTextMethodTester(String input, Function<T,Object> componentFunction, Class<T> outputClass, String output)
input - path to the text (usually hex) file describing the method invocationscomponentFunction - function producing the component(s) that will process the invocationsoutputClass - interface class defining the methods encoded in the filesoutput - path to the expected output filepublic String setup()
@NotNull public @NotNull BytesTextMethodTester setup(String setup)
setup - path to the setup filepublic Function<String,String> afterRun()
@NotNull public @NotNull BytesTextMethodTester afterRun(UnaryOperator<String> afterRun)
afterRun - normalising function@NotNull public @NotNull BytesTextMethodTester run() throws IOException
expected() and actual().IOException - if any of the files cannot be readpublic String expected()
public String actual()
Copyright © 2026 Chronicle Software Ltd. All rights reserved.