1   /* Copyright 2022-2025 Romain Serra
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.bodies;
18  
19  import org.hipparchus.util.Binary64;
20  import org.hipparchus.util.Binary64Field;
21  import org.junit.jupiter.api.Test;
22  import org.orekit.time.AbsoluteDate;
23  import org.orekit.time.FieldAbsoluteDate;
24  
25  import static org.junit.jupiter.api.Assertions.*;
26  
27  class FieldTimeStampedGeodeticPointTest {
28  
29      @Test
30      void testConstructorFromNonField() {
31          // GIVEN
32          final GeodeticPoint point = new GeodeticPoint(1, 2, 3);
33          final Binary64Field field = Binary64Field.getInstance();
34          final AbsoluteDate date = AbsoluteDate.ARBITRARY_EPOCH;
35          // WHEN
36          final FieldTimeStampedGeodeticPoint<Binary64> fieldTimeStampedGeodeticPoint = new FieldTimeStampedGeodeticPoint<>(field,
37                  new TimeStampedGeodeticPoint(date, point));
38          // THEN
39          assertEquals(date, fieldTimeStampedGeodeticPoint.getDate().toAbsoluteDate());
40          assertEquals(point, fieldTimeStampedGeodeticPoint.toGeodeticPoint());
41      }
42  
43      @Test
44      void testEquals() {
45          // GIVEN
46          final GeodeticPoint point = new GeodeticPoint(1, 2, 3);
47          final Binary64Field field = Binary64Field.getInstance();
48          final AbsoluteDate date = AbsoluteDate.ARBITRARY_EPOCH;
49          // WHEN
50          final FieldTimeStampedGeodeticPoint<Binary64> fieldTimeStampedGeodeticPoint = new FieldTimeStampedGeodeticPoint<>(new FieldAbsoluteDate<>(field, date),
51                  new FieldGeodeticPoint<>(field, point));
52          // THEN
53          assertNotEquals(fieldTimeStampedGeodeticPoint, point);
54          assertEquals(fieldTimeStampedGeodeticPoint, new FieldTimeStampedGeodeticPoint<>(fieldTimeStampedGeodeticPoint.getDate(),
55                  fieldTimeStampedGeodeticPoint.getLatitude(), fieldTimeStampedGeodeticPoint.getLongitude(), fieldTimeStampedGeodeticPoint.getAltitude()));
56      }
57  }