1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.estimation.measurements.gnss;
18
19 import org.junit.jupiter.api.Assertions;
20 import org.junit.jupiter.api.Test;
21 import org.orekit.gnss.SatelliteSystem;
22
23 public class InterSatellitesWindUpFactoryTest {
24
25 @Test
26 public void testDifferentFactories() {
27 InterSatellitesWindUp windUp1 = new InterSatellitesWindUpFactory().
28 getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J,
29 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J);
30 Assertions.assertEquals(0, windUp1.getParametersDrivers().size());
31 InterSatellitesWindUp windUp2 = new InterSatellitesWindUpFactory().
32 getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J,
33 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J);
34 Assertions.assertEquals(0, windUp2.getParametersDrivers().size());
35 Assertions.assertNotSame(windUp1, windUp2);
36 }
37
38 @Test
39 public void testSameFactory() {
40 InterSatellitesWindUpFactory factory = new InterSatellitesWindUpFactory();
41 InterSatellitesWindUp windUp1 = factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J,
42 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J);
43 Assertions.assertEquals(0, windUp1.getParametersDrivers().size());
44 InterSatellitesWindUp windUp2 = factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J,
45 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J);
46 Assertions.assertEquals(0, windUp2.getParametersDrivers().size());
47 Assertions.assertSame(windUp1, windUp2);
48 }
49
50 @Test
51 public void testCachedInstances() {
52
53 InterSatellitesWindUpFactory factory = new InterSatellitesWindUpFactory();
54 InterSatellitesWindUp[] windUp1 = {
55 factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J,
56 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J),
57 factory.getWindUp(SatelliteSystem.GLONASS, 1, Dipole.CANONICAL_I_J,
58 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J),
59 factory.getWindUp(SatelliteSystem.GALILEO, 2, Dipole.CANONICAL_I_J,
60 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J),
61 factory.getWindUp(SatelliteSystem.GLONASS, 2, Dipole.CANONICAL_I_J,
62 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J),
63 factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J,
64 SatelliteSystem.USER_DEFINED_K, 32, Dipole.CANONICAL_I_J),
65 factory.getWindUp(SatelliteSystem.GLONASS, 1, Dipole.CANONICAL_I_J,
66 SatelliteSystem.USER_DEFINED_K, 32, Dipole.CANONICAL_I_J),
67 factory.getWindUp(SatelliteSystem.GALILEO, 2, Dipole.CANONICAL_I_J,
68 SatelliteSystem.USER_DEFINED_K, 32, Dipole.CANONICAL_I_J),
69 factory.getWindUp(SatelliteSystem.GLONASS, 2, Dipole.CANONICAL_I_J,
70 SatelliteSystem.USER_DEFINED_K, 32, Dipole.CANONICAL_I_J)
71 };
72 InterSatellitesWindUp[] windUp2 = {
73 factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J,
74 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J),
75 factory.getWindUp(SatelliteSystem.GLONASS, 1, Dipole.CANONICAL_I_J,
76 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J),
77 factory.getWindUp(SatelliteSystem.GALILEO, 2, Dipole.CANONICAL_I_J,
78 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J),
79 factory.getWindUp(SatelliteSystem.GLONASS, 2, Dipole.CANONICAL_I_J,
80 SatelliteSystem.USER_DEFINED_D, 17, Dipole.CANONICAL_I_J),
81 factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J,
82 SatelliteSystem.USER_DEFINED_K, 32, Dipole.CANONICAL_I_J),
83 factory.getWindUp(SatelliteSystem.GLONASS, 1, Dipole.CANONICAL_I_J,
84 SatelliteSystem.USER_DEFINED_K, 32, Dipole.CANONICAL_I_J),
85 factory.getWindUp(SatelliteSystem.GALILEO, 2, Dipole.CANONICAL_I_J,
86 SatelliteSystem.USER_DEFINED_K, 32, Dipole.CANONICAL_I_J),
87 factory.getWindUp(SatelliteSystem.GLONASS, 2, Dipole.CANONICAL_I_J,
88 SatelliteSystem.USER_DEFINED_K, 32, Dipole.CANONICAL_I_J)
89 };
90
91 for (int i = 0; i < windUp1.length; ++i) {
92 for (int j = 0; j < windUp1.length; ++j) {
93 if (i != j) {
94 Assertions.assertNotSame(windUp1[i], windUp1[j]);
95 Assertions.assertNotSame(windUp2[i], windUp2[j]);
96 }
97 }
98 Assertions.assertSame(windUp1[i], windUp2[i]);
99 }
100
101 }
102
103 }