T
- the type of the interface that includes the methods to be tested.public class BytesTextMethodTester<T> extends Object
BytesTextMethodTester
class is a utility for comparing the expected and actual results
of executing a method from a given interface that manipulates bytes. It utilizes hexadecimal data
from the input and output files to perform this comparison.Constructor and Description |
---|
BytesTextMethodTester(String input,
Function<T,Object> componentFunction,
Class<T> outputClass,
String output)
Constructs a
BytesTextMethodTester instance with the provided parameters. |
Modifier and Type | Method and Description |
---|---|
String |
actual() |
Function<String,String> |
afterRun() |
@NotNull BytesTextMethodTester |
afterRun(UnaryOperator<String> afterRun) |
String |
expected() |
@NotNull BytesTextMethodTester |
run()
Runs the methods of the class under test using the hexadecimal data from the input file,
then compares the results with the expected output from the output file.
|
String |
setup() |
@NotNull BytesTextMethodTester |
setup(String setup) |
public BytesTextMethodTester(String input, Function<T,Object> componentFunction, Class<T> outputClass, String output)
BytesTextMethodTester
instance with the provided parameters.input
- The input file containing hexadecimal data to feed into the methods of the class under test.componentFunction
- A function that defines how to instantiate or manipulate the object that the class under test needs.outputClass
- The class of the interface that includes the methods to be tested.output
- The output file containing the expected hexadecimal results of the tested methods.public String setup()
@NotNull public @NotNull BytesTextMethodTester setup(String setup)
@NotNull public @NotNull BytesTextMethodTester afterRun(UnaryOperator<String> afterRun)
@NotNull public @NotNull BytesTextMethodTester run() throws IOException, IllegalArgumentException, IllegalStateException, BufferUnderflowException
BytesTextMethodTester
, allowing for method chaining.IOException
- If an I/O error occurs when reading the files or writing the results.IllegalArgumentException
- If an illegal argument is used.IllegalStateException
- If an illegal state is encountered.BufferUnderflowException
- If there is no more data left to read in the buffer.public String expected()
public String actual()
Copyright © 2023. All rights reserved.