1   /* Copyright 2022-2026 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.estimation.measurements.modifiers;
18  
19  import org.junit.jupiter.api.Test;
20  import org.orekit.TestUtils;
21  import org.orekit.estimation.measurements.AngularAzEl;
22  import org.orekit.estimation.measurements.EstimatedMeasurementBase;
23  import org.orekit.estimation.measurements.GroundStation;
24  import org.orekit.estimation.measurements.ObservableSatellite;
25  import org.orekit.models.AtmosphericRefractionModel;
26  import org.orekit.propagation.SpacecraftState;
27  import org.orekit.time.AbsoluteDate;
28  import org.orekit.utils.TimeStampedPVCoordinates;
29  import static org.junit.jupiter.api.Assertions.assertEquals;
30  import static org.mockito.ArgumentMatchers.any;
31  import static org.mockito.Mockito.mock;
32  import static org.mockito.Mockito.when;
33  
34  class AngularRadioRefractionModifierTest {
35  
36      @Test
37      void testModifyWithoutDerivatives() {
38          // GIVEN
39          final SpacecraftState state = new SpacecraftState(TestUtils.getDefaultOrbit(AbsoluteDate.ARBITRARY_EPOCH));
40          final GroundStation station = mock();
41          final AngularAzEl angularAzEl = new AngularAzEl(station, AbsoluteDate.ARBITRARY_EPOCH, new double[2], new double[2], new double[2], new ObservableSatellite(0));
42          final EstimatedMeasurementBase<AngularAzEl> estimated = new EstimatedMeasurementBase<>(angularAzEl, 0, 0,
43                  new SpacecraftState[] {state}, new TimeStampedPVCoordinates[]{state.getPVCoordinates()});
44          final double elevation = 1.;
45          estimated.setEstimatedValue(2.0, elevation);
46          final AtmosphericRefractionModel refractionModel = mock();
47          final AngularRadioRefractionModifier modifier = new AngularRadioRefractionModifier(refractionModel);
48          final double expectedRefraction = 0.1;
49          when(refractionModel.getRefraction(any(Double.class))).thenReturn(expectedRefraction);
50          // WHEN
51          modifier.modifyWithoutDerivatives(estimated);
52          // THEN
53          assertEquals(expectedRefraction, estimated.getEstimatedValue()[1] - elevation, 1e-15);
54      }
55  }