1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.propagation.events.handlers;
18
19 import org.hipparchus.ode.events.Action;
20 import org.junit.jupiter.api.Assertions;
21 import org.junit.jupiter.api.Test;
22
23 class AbstractGenericCountingHandlerTest {
24
25 @Test
26 void testSetHandler() {
27
28 final TestHandler testHandler = new TestHandler(1);
29 final Action unexpectedAction = testHandler.getAction();
30 final Action expectedAction = Action.STOP;
31
32 testHandler.setAction(expectedAction);
33
34 Assertions.assertEquals(expectedAction, testHandler.getAction());
35 Assertions.assertNotEquals(unexpectedAction, testHandler.getAction());
36 }
37
38 @Test
39 void testReset() {
40
41 final TestHandler testHandler = new TestHandler(1);
42
43 testHandler.reset();
44
45 Assertions.assertEquals(0, testHandler.getCount());
46 }
47
48 @Test
49 void testIncrement() {
50
51 final TestHandler testHandler = new TestHandler(0);
52
53 testHandler.increment();
54
55 Assertions.assertEquals(1, testHandler.getCount());
56 }
57
58 private static class TestHandler extends AbstractGenericCountingHandler {
59
60 protected TestHandler(int startingCount) {
61 super(startingCount, Action.CONTINUE);
62 }
63 }
64 }