1   /* Copyright 2002-2022 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.forces.maneuvers.triggers;
18  
19  
20  import java.util.stream.Stream;
21  
22  import org.hipparchus.CalculusFieldElement;
23  import org.hipparchus.Field;
24  import org.hipparchus.util.Decimal64Field;
25  import org.junit.Assert;
26  import org.junit.Test;
27  import org.orekit.forces.maneuvers.trigger.ManeuverTriggers;
28  import org.orekit.frames.FramesFactory;
29  import org.orekit.orbits.KeplerianOrbit;
30  import org.orekit.orbits.PositionAngle;
31  import org.orekit.propagation.FieldSpacecraftState;
32  import org.orekit.propagation.SpacecraftState;
33  import org.orekit.propagation.events.EventDetector;
34  import org.orekit.propagation.events.FieldEventDetector;
35  import org.orekit.time.AbsoluteDate;
36  import org.orekit.time.FieldAbsoluteDate;
37  import org.orekit.utils.Constants;
38  
39  public class ManeuverTriggersTest {
40  
41      @Test
42      public void testNoOpDefault() {
43          // just test the default no-op implementation can be called without side effects
44          ManeuverTriggers dummy = new ManeuverTriggers() {
45              public <T extends CalculusFieldElement<T>> boolean isFiring(FieldAbsoluteDate<T> date, T[] parameters) {
46                  return false;
47              }
48              public boolean isFiring(AbsoluteDate date, double[] parameters) {
49                  return false;
50              }
51              public <T extends CalculusFieldElement<T>> Stream<FieldEventDetector<T>> getFieldEventsDetectors(Field<T> field) {
52                  return null;
53              }
54              public Stream<EventDetector> getEventsDetectors() {
55                   return null;
56              }
57          };
58  
59          SpacecraftState state = new SpacecraftState(new KeplerianOrbit(7e6, 0.1, 0.2, 0.3, 0.4, 0.5,
60                                                                         PositionAngle.MEAN, FramesFactory.getGCRF(),
61                                                                         AbsoluteDate.J2000_EPOCH,
62                                                                         Constants.EIGEN5C_EARTH_MU));
63          dummy.init(state, state.getDate().shiftedBy(60));
64          dummy.init(new FieldSpacecraftState<>(Decimal64Field.getInstance(), state),
65                     new FieldAbsoluteDate<>(Decimal64Field.getInstance(), state.getDate().shiftedBy(60)));
66          Assert.assertEquals("", dummy.getName());
67  
68      }
69  
70  }