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.ssa.metrics;
18  
19  import org.junit.jupiter.api.Assertions;
20  import org.junit.jupiter.api.DisplayName;
21  import org.junit.jupiter.api.Test;
22  import org.orekit.ssa.collision.shorttermencounter.probability.twod.Laas2015;
23  import org.orekit.ssa.collision.shorttermencounter.probability.twod.ShortTermEncounter2DPOCMethod;
24  
25  class ProbabilityOfCollisionTest {
26  
27      @Test
28      @DisplayName("Test ProbabilityOfCollision constructor")
29      void testCreateExpectedProbabilityOfCollisionInstance() {
30          // GIVEN
31          final double                        value      = 0.1;
32          final double                        upperLimit = 0.2;
33          final double                        lowerLimit = 0.05;
34          final ShortTermEncounter2DPOCMethod method     = new Laas2015();
35  
36          // WHEN
37          final ProbabilityOfCollision probabilityOfCollision = new ProbabilityOfCollision(value, lowerLimit, upperLimit,
38                                                                                           method.getName(),
39                                                                                           method.isAMaximumProbabilityOfCollisionMethod());
40  
41          // THEN
42          Assertions.assertEquals(0.1, probabilityOfCollision.getValue());
43          Assertions.assertEquals(0.2, probabilityOfCollision.getUpperLimit());
44          Assertions.assertEquals(0.05, probabilityOfCollision.getLowerLimit());
45          Assertions.assertEquals(new Laas2015().getName(),
46                                  probabilityOfCollision.getProbabilityOfCollisionMethodName());
47          Assertions.assertFalse(probabilityOfCollision.isMaxProbability());
48      }
49  
50      @Test
51      @DisplayName("Test ProbabilityOfCollision constructor with default value for the upper and lower limit")
52      void testCreateProbabilityOfCollisionWithDefaultUpperAndLowerLimit() {
53          // GIVEN
54          final double                        value  = 0.1;
55          final ShortTermEncounter2DPOCMethod method = new Laas2015();
56  
57          // WHEN
58          final ProbabilityOfCollision probabilityOfCollision = new ProbabilityOfCollision(value, method.getName());
59          // THEN
60          Assertions.assertEquals(0.1, probabilityOfCollision.getValue());
61          Assertions.assertEquals(0, probabilityOfCollision.getUpperLimit());
62          Assertions.assertEquals(0, probabilityOfCollision.getLowerLimit());
63          Assertions.assertEquals(new Laas2015().getName(),
64                                  probabilityOfCollision.getProbabilityOfCollisionMethodName());
65      }
66  
67  }