1 /* Copyright 2002-2025 CS GROUP
2 * Licensed to CS GROUP (CS) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * CS licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
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 import org.orekit.frames.FramesFactory;
23 import org.orekit.orbits.KeplerianOrbit;
24 import org.orekit.orbits.PositionAngleType;
25 import org.orekit.propagation.SpacecraftState;
26 import org.orekit.time.AbsoluteDate;
27 import org.orekit.utils.Constants;
28
29 public class StopOnIncreasingTest {
30
31 @Test
32 public void testNoReset() {
33 SpacecraftState s = new SpacecraftState(new KeplerianOrbit(24464560.0, 0.7311, 0.122138, 3.10686, 1.00681,
34 0.048363, PositionAngleType.MEAN,
35 FramesFactory.getEME2000(),
36 AbsoluteDate.J2000_EPOCH,
37 Constants.EIGEN5C_EARTH_MU));
38 Assertions.assertSame(s, new StopOnIncreasing().resetState(null, s));
39 }
40
41 @Test
42 public void testIncreasing() {
43 SpacecraftState s = new SpacecraftState(new KeplerianOrbit(24464560.0, 0.7311, 0.122138, 3.10686, 1.00681,
44 0.048363, PositionAngleType.MEAN,
45 FramesFactory.getEME2000(),
46 AbsoluteDate.J2000_EPOCH,
47 Constants.EIGEN5C_EARTH_MU));
48 Assertions.assertSame(Action.STOP, new StopOnIncreasing().eventOccurred(s, null, true));
49 }
50
51 @Test
52 public void testDecreasing() {
53 SpacecraftState s = new SpacecraftState(new KeplerianOrbit(24464560.0, 0.7311, 0.122138, 3.10686, 1.00681,
54 0.048363, PositionAngleType.MEAN,
55 FramesFactory.getEME2000(),
56 AbsoluteDate.J2000_EPOCH,
57 Constants.EIGEN5C_EARTH_MU));
58 Assertions.assertSame(Action.CONTINUE, new StopOnIncreasing().eventOccurred(s, null, false));
59 }
60
61 }
62