Compare commits

..

2 Commits

Author SHA1 Message Date
Vyacheslav Boyko
9fb2276ac1 test updated 2022-07-12 17:42:07 +03:00
Vyacheslav Boyko
35285b61bf mistake 2022-07-11 15:49:55 +03:00
5 changed files with 13 additions and 5 deletions

View File

@ -7,6 +7,6 @@ package me.bvn13.fsm;
@FunctionalInterface
public interface StateHandler<T extends Fsm> {
void handle(T fms);
void handle(T fsm);
}

View File

@ -8,6 +8,6 @@ package me.bvn13.fsm;
@FunctionalInterface
public interface StateProcessor<T extends Fsm, E> {
void process(T fms, E event);
void process(T fsm, E event);
}

View File

@ -5,7 +5,7 @@ import me.bvn13.fsm.StateHandler;
public class DummyHandler<T extends Fsm> implements StateHandler<T> {
@Override
public void handle(T fms) {
public void handle(T fsm) {
}
}

View File

@ -5,7 +5,7 @@ import me.bvn13.fsm.StateProcessor;
public class DummyProcessor<T extends Fsm,E> implements StateProcessor<T,E> {
@Override
public void process(T fms, E event) {
public void process(T fsm, E event) {
}
}

View File

@ -92,6 +92,8 @@ public class FsmTest {
.withAfterHandler(fsm -> initAfter.set(true))
.withProcessor((fsm, event) -> initProcess.set(true))
.end()
.state("intermediate")
.end()
.finish("finish")
.withBeforeHandler(fsm -> finishBefore.set(true))
.withAfterHandler(fsm -> finishAfter.set(true))
@ -99,6 +101,11 @@ public class FsmTest {
.end()
.withTransition()
.from("init")
.to("intermediate")
.checking((fsm, event) -> true)
.end()
.withTransition()
.from("intermediate")
.to("finish")
.checking((fsm, event) -> true)
.end()
@ -107,9 +114,10 @@ public class FsmTest {
// @formatter:on
simpleFsm.process("");
simpleFsm.process("");
//Assert.assertEquals("finish", simpleFsm.getCurrentState().getName());
Assert.assertEquals("finish", simpleFsm.getCurrentState().getName());
Assert.assertTrue(initBefore.get());
Assert.assertTrue(initProcess.get());
Assert.assertTrue(initAfter.get());