dcapwell commented on code in PR #103:
URL: https://github.com/apache/cassandra-accord/pull/103#discussion_r1674896283
##########
accord-core/src/test/java/accord/utils/Property.java:
##########
@@ -510,12 +604,42 @@ default Void run(SystemUnderTest sut) throws Throwable
}
}
+ public static class SimpleCommand<State> implements UnitCommand<State,
Void>
+ {
+ private final String name;
+ private final Consumer<State> fn;
+
+ public SimpleCommand(String name, Consumer<State> fn)
+ {
+ this.name = name;
+ this.fn = fn;
+ }
+
+ @Override
+ public String detailed(State state)
+ {
+ return name;
+ }
+
+ @Override
+ public void applyUnit(State state) throws Throwable
+ {
+ fn.accept(state);
+ }
+
+ @Override
+ public void runUnit(Void sut) throws Throwable
+ {
+
+ }
+ }
+
public interface Commands<State, SystemUnderTest>
{
Gen<State> genInitialState() throws Throwable;
SystemUnderTest createSut(State state) throws Throwable;
- default void destroyState(State state) throws Throwable {}
- default void destroySut(SystemUnderTest sut) throws Throwable {}
+ default void destroyState(State state, @Nullable Throwable cause)
throws Throwable {}
Review Comment:
There are cases that need to know if the test failed or not to figure out
how to destroy; one such test is `EpochSyncTest` which finishes running all
scheduled tasks in `destroyState` but has no reason to if the test already
failed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]