1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.propagation.events;
18
19 import org.junit.jupiter.api.Test;
20 import org.orekit.propagation.SpacecraftState;
21
22 import static org.junit.jupiter.api.Assertions.*;
23 import static org.mockito.Mockito.mock;
24
25 class EnablingPredicateTest {
26
27 @Test
28 void testOrCombine() {
29
30 final SpacecraftState mockedState = mock();
31 final EventDetector mockedDetector = mock();
32 final EnablingPredicate truePredicate = ((state, detector, g) -> true);
33 final EnablingPredicate falsePredicate = ((state, detector, g) -> false);
34
35 final EnablingPredicate combined = EnablingPredicate.orCombine(truePredicate, falsePredicate);
36
37 final boolean actual = combined.eventIsEnabled(mockedState, mockedDetector, 0.);
38 assertTrue(actual);
39 }
40
41 @Test
42 void testAndCombine() {
43
44 final SpacecraftState mockedState = mock();
45 final EventDetector mockedDetector = mock();
46 final EnablingPredicate truePredicate = ((state, detector, g) -> true);
47 final EnablingPredicate falsePredicate = ((state, detector, g) -> false);
48
49 final EnablingPredicate combined = EnablingPredicate.andCombine(truePredicate, falsePredicate);
50
51 final boolean actual = combined.eventIsEnabled(mockedState, mockedDetector, 0.);
52 assertFalse(actual);
53 }
54 }