T - The type of the output class.public class TextMethodTester<T> extends Object implements YamlTester
| Modifier and Type | Class and Description |
|---|---|
static interface |
TextMethodTester.PostSetup
Represents an action that should be performed after a setup procedure.
|
| Modifier and Type | Field and Description |
|---|---|
static Consumer<net.openhft.chronicle.core.util.InvocationTargetRuntimeException> |
DEFAULT_INVOCATION_TARGET_RUNTIME_EXCEPTION_CONSUMER |
static boolean |
SINGLE_THREADED_CHECK_DISABLED |
BASE_TESTS, REGRESS_TESTS| Constructor and Description |
|---|
TextMethodTester(String input,
BiFunction<T,net.openhft.chronicle.bytes.UpdateInterceptor,Object> componentFunction,
Class<T> outputClass,
String output)
Constructs a TextMethodTester with specified input, component function, output class, and output.
|
TextMethodTester(String input,
Function<T,Object> componentFunction,
Class<T> outputClass,
String output)
Constructs a TextMethodTester with specified input, component function, output class, and output.
|
TextMethodTester(String input,
Function<T,Object> componentFunction,
Function<WireOut,T> outputFunction,
String output)
Constructs a TextMethodTester with specified input, component function, output function, and output.
|
| Modifier and Type | Method and Description |
|---|---|
String |
actual()
Retrieves the actual test output.
|
TextMethodTester<T> |
addOutputClass(Class<?> outputClass)
Adds an output class to the tester.
|
Function<String,String> |
afterRun()
Retrieves the after-run function.
|
@NotNull TextMethodTester<T> |
afterRun(Function<String,String> afterRun)
Specifies the function to execute after a run.
|
Map<String,String> |
agitate(YamlAgitator agitator)
Generates additional tests based on the current test configuration by using a specified YamlAgitator.
|
protected Wire |
createWire(byte[] byteArray)
Creates a
Wire object from a given byte array. |
protected Wire |
createWire(net.openhft.chronicle.bytes.Bytes<?> bytes)
Creates a
Wire instance based on the provided bytes. |
TextMethodTester<T> |
exceptionHandlerFunction(Function<T,net.openhft.chronicle.core.onoes.ExceptionHandler> exceptionHandlerFunction)
Sets the exception handling function for the tester.
|
TextMethodTester<T> |
exceptionHandlerFunctionAndLog(boolean exceptionHandlerFunctionAndLog)
Configures whether the tester should log the exception handling function.
|
BiConsumer<net.openhft.chronicle.bytes.MethodReader,T> |
exceptionHandlerSetup()
Retrieves the exception handler setup.
|
TextMethodTester<T> |
exceptionHandlerSetup(BiConsumer<net.openhft.chronicle.bytes.MethodReader,T> exceptionHandlerSetup)
Specifies the BiConsumer for handling the exception setup.
|
String |
expected()
Retrieves the expected output result.
|
String |
genericEvent()
Retrieves the generic event string.
|
TextMethodTester<T> |
genericEvent(String genericEvent)
Specifies the generic event string.
|
TextMethodTester<T> |
inputFunction(Function<String,String> inputFunction)
Configures the input transformation function for the tester.
|
protected @NotNull StringBuilder |
loadLastValues()
Loads the last values from the output wire file.
|
TextMethodTester<T> |
methodReaderInterceptorReturns(net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns)
Sets the
MethodReaderInterceptorReturns for the tester. |
Consumer<net.openhft.chronicle.core.util.InvocationTargetRuntimeException> |
onInvocationException()
Retrieves the exception consumer for InvocationTargetRuntimeException.
|
TextMethodTester<T> |
onInvocationException(Consumer<net.openhft.chronicle.core.util.InvocationTargetRuntimeException> onInvocationException)
Specifies the consumer for InvocationTargetRuntimeException.
|
boolean |
readOne(net.openhft.chronicle.bytes.MethodReader reader0,
net.openhft.chronicle.core.onoes.ExceptionHandler exceptionHandler)
Attempts to read a single message or event from the provided
MethodReader. |
static boolean |
resourceExists(String resourceName)
Checks if a given resource exists.
|
String[] |
retainLast()
Gets the strings to be retained from the last run.
|
@NotNull TextMethodTester<T> |
retainLast(String... retainLast)
Specifies strings that should be retained from the last run.
|
@NotNull TextMethodTester<T> |
run()
Executes the test based on the specified setup.
|
String |
setup()
Retrieves the single setup value.
|
@NotNull TextMethodTester<T> |
setup(@Nullable String setup)
Specifies a single setup string for the method tester.
|
@NotNull TextMethodTester<T> |
setups(@NotNull List<String> setups)
Specifies a list of setup strings for the method tester.
|
TextMethodTester<T> |
testFilter(Predicate<String> testFilter)
Sets a filter for the tester to determine which tests should be executed.
|
TextMethodTester<T> |
timeoutMS(long timeoutMS)
Sets the timeout (in milliseconds) for the tester.
|
TextMethodTester<T> |
updateInterceptor(net.openhft.chronicle.bytes.UpdateInterceptor updateInterceptor)
Sets the
UpdateInterceptor for the tester. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrunTest, runTest, runTestpublic static final boolean SINGLE_THREADED_CHECK_DISABLED
public static final Consumer<net.openhft.chronicle.core.util.InvocationTargetRuntimeException> DEFAULT_INVOCATION_TARGET_RUNTIME_EXCEPTION_CONSUMER
public TextMethodTester(String input, Function<T,Object> componentFunction, Class<T> outputClass, String output)
input - The text input for the method.componentFunction - Function to handle components within the tester.outputClass - The class representing the type of output.output - The text representation of the output.public TextMethodTester(String input, BiFunction<T,net.openhft.chronicle.bytes.UpdateInterceptor,Object> componentFunction, Class<T> outputClass, String output)
input - The text input for the method.componentFunction - BiFunction to handle components with an update interceptor.outputClass - The class representing the type of output.output - The text representation of the output.public TextMethodTester(String input, Function<T,Object> componentFunction, Function<WireOut,T> outputFunction, String output)
input - The text input for the method.componentFunction - Function to handle components within the tester.outputFunction - Function to generate the output based on wire data.output - The text representation of the output.public TextMethodTester<T> addOutputClass(Class<?> outputClass)
outputClass - The additional output class to be added.public static boolean resourceExists(String resourceName)
resourceName - The name of the resource.public String[] retainLast()
@NotNull public @NotNull TextMethodTester<T> retainLast(String... retainLast)
retainLast - Strings to retain.public String setup()
IllegalStateException - if there are no setups or more than one setup.@NotNull public @NotNull TextMethodTester<T> setup(@Nullable @Nullable String setup)
setup - The setup string to set.@NotNull public @NotNull TextMethodTester<T> setups(@NotNull @NotNull List<String> setups)
setups - The list of setup strings.public Function<String,String> afterRun()
@NotNull public @NotNull TextMethodTester<T> afterRun(Function<String,String> afterRun)
afterRun - The after-run function.public BiConsumer<net.openhft.chronicle.bytes.MethodReader,T> exceptionHandlerSetup()
public TextMethodTester<T> exceptionHandlerSetup(BiConsumer<net.openhft.chronicle.bytes.MethodReader,T> exceptionHandlerSetup)
exceptionHandlerSetup - The exception handler setup BiConsumer.public String genericEvent()
public TextMethodTester<T> genericEvent(String genericEvent)
genericEvent - The generic event string.public Consumer<net.openhft.chronicle.core.util.InvocationTargetRuntimeException> onInvocationException()
public TextMethodTester<T> onInvocationException(Consumer<net.openhft.chronicle.core.util.InvocationTargetRuntimeException> onInvocationException)
onInvocationException - The consumer for InvocationTargetRuntimeException.@NotNull public @NotNull TextMethodTester<T> run() throws IOException
IOException - if there is an error in IO operations.public Map<String,String> agitate(YamlAgitator agitator) throws net.openhft.chronicle.core.io.IORuntimeException
YamlTesteragitate in interface YamlTesteragitator - YamlAgitator instance used to create additional test cases.net.openhft.chronicle.core.io.IORuntimeException - if an I/O error occurs during test generation.public boolean readOne(net.openhft.chronicle.bytes.MethodReader reader0,
net.openhft.chronicle.core.onoes.ExceptionHandler exceptionHandler)
MethodReader.
Handles any exceptions thrown during the reading process by using the provided ExceptionHandler or the default onInvocationException.reader0 - The MethodReader used to read the message or event.exceptionHandler - The handler to manage any exceptions thrown during the reading process.protected Wire createWire(byte[] byteArray)
Wire object from a given byte array.
This method provides flexibility by allowing input to be processed using the inputFunction if it's set, or using the byte array directly if it's not.byteArray - The byte array from which the Wire object will be created.protected Wire createWire(net.openhft.chronicle.bytes.Bytes<?> bytes)
Wire instance based on the provided bytes.
The choice between creating a YamlWire or a TextWire is determined by the value of the TEXT_AS_YAML flag.
In both cases, text documents and timestamps are enabled.bytes - The bytes from which the Wire instance will be created.@NotNull protected @NotNull StringBuilder loadLastValues() throws IOException, net.openhft.chronicle.core.io.InvalidMarshallableException
IOException - If there's a problem reading the wire file.net.openhft.chronicle.core.io.InvalidMarshallableException - If the wire file contains invalid or unmarshallable data.public String expected()
expected in interface YamlTesternet.openhft.chronicle.core.io.IORuntimeException - If there's an IO issue while running the test.public String actual()
actual in interface YamlTesternet.openhft.chronicle.core.io.IORuntimeException - If there's an IO issue while running the test.public TextMethodTester<T> updateInterceptor(net.openhft.chronicle.bytes.UpdateInterceptor updateInterceptor)
UpdateInterceptor for the tester.
This allows for custom logic to be executed when updates are detected.updateInterceptor - The update interceptor to set.public TextMethodTester<T> methodReaderInterceptorReturns(net.openhft.chronicle.bytes.MethodReaderInterceptorReturns methodReaderInterceptorReturns)
MethodReaderInterceptorReturns for the tester.
This allows for custom interception of method reader return values.methodReaderInterceptorReturns - The method reader interceptor to set.public TextMethodTester<T> timeoutMS(long timeoutMS)
timeoutMS - The timeout in milliseconds to set.public TextMethodTester<T> exceptionHandlerFunction(Function<T,net.openhft.chronicle.core.onoes.ExceptionHandler> exceptionHandlerFunction)
exceptionHandlerFunction - The exception handling function to set.public TextMethodTester<T> exceptionHandlerFunctionAndLog(boolean exceptionHandlerFunctionAndLog)
exceptionHandlerFunctionAndLog - Flag to determine if the exception handling function should be logged.public TextMethodTester<T> testFilter(Predicate<String> testFilter)
testFilter - The filter predicate that accepts a test's name as a parameter.public TextMethodTester<T> inputFunction(Function<String,String> inputFunction)
inputFunction - The function that transforms input values.Copyright © 2024. All rights reserved.