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  
18  package org.orekit.propagation.conversion;
19  
20  import org.hipparchus.geometry.euclidean.threed.Vector3D;
21  import org.junit.jupiter.api.Assertions;
22  import org.junit.jupiter.api.BeforeEach;
23  import org.junit.jupiter.api.Test;
24  import org.orekit.Utils;
25  import org.orekit.forces.gravity.potential.GravityFieldFactory;
26  import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider;
27  import org.orekit.frames.FramesFactory;
28  import org.orekit.orbits.CartesianOrbit;
29  import org.orekit.orbits.Orbit;
30  import org.orekit.orbits.PositionAngleType;
31  import org.orekit.time.AbsoluteDate;
32  import org.orekit.utils.Constants;
33  import org.orekit.utils.PVCoordinates;
34  
35  import static org.orekit.propagation.conversion.AbstractPropagatorBuilderTest.assertPropagatorBuilderIsACopy;
36  
37  public class EcksteinHechlerPropagatorBuilderTest {
38  
39      @BeforeEach
40      public void initialize() {
41          Utils.setDataRoot("potential");
42      }
43  
44      @Test
45      void testClone() {
46  
47          // Given
48          final Orbit orbit = new CartesianOrbit(new PVCoordinates(
49                  new Vector3D(Constants.EIGEN5C_EARTH_EQUATORIAL_RADIUS + 400000, 0, 0),
50                  new Vector3D(10, 7668.6, 3)), FramesFactory.getGCRF(),
51                  new AbsoluteDate(), Constants.EIGEN5C_EARTH_MU);
52  
53          final UnnormalizedSphericalHarmonicsProvider harmonicsProvider = GravityFieldFactory.getUnnormalizedProvider(6, 0);
54  
55          final EcksteinHechlerPropagatorBuilder builder = new EcksteinHechlerPropagatorBuilder(orbit, harmonicsProvider,
56                  PositionAngleType.MEAN, 10.0);
57  
58          // When
59          final EcksteinHechlerPropagatorBuilder copyBuilder = (EcksteinHechlerPropagatorBuilder) builder.clone();
60  
61          // Then
62          assertPropagatorBuilderIsACopy(builder, copyBuilder);
63          Assertions.assertEquals(builder.getImpulseManeuvers().size(), copyBuilder.getImpulseManeuvers().size());
64  
65      }
66  }