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 WindUpFactoryTest {
24
25 @Test
26 public void testDifferentFactories() {
27 WindUp windUp1 = new WindUpFactory().getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J, "ABC123");
28 Assertions.assertEquals(0, windUp1.getParametersDrivers().size());
29 WindUp windUp2 = new WindUpFactory().getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J, "ABC123");
30 Assertions.assertEquals(0, windUp2.getParametersDrivers().size());
31 Assertions.assertNotSame(windUp1, windUp2);
32 }
33
34 @Test
35 public void testSameFactory() {
36 WindUpFactory factory = new WindUpFactory();
37 WindUp windUp1 = factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J, "ABC123");
38 Assertions.assertEquals(0, windUp1.getParametersDrivers().size());
39 WindUp windUp2 = factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J, "ABC123");
40 Assertions.assertEquals(0, windUp2.getParametersDrivers().size());
41 Assertions.assertSame(windUp1, windUp2);
42 }
43
44 @Test
45 public void testCachedInstances() {
46
47 WindUpFactory factory = new WindUpFactory();
48 WindUp[] windUp1 = {
49 factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J, "ABC123"),
50 factory.getWindUp(SatelliteSystem.GLONASS, 1, Dipole.CANONICAL_I_J, "ABC123"),
51 factory.getWindUp(SatelliteSystem.GALILEO, 2, Dipole.CANONICAL_I_J, "ABC123"),
52 factory.getWindUp(SatelliteSystem.GLONASS, 2, Dipole.CANONICAL_I_J, "ABC123"),
53 factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J, "XYZ789"),
54 factory.getWindUp(SatelliteSystem.GLONASS, 1, Dipole.CANONICAL_I_J, "XYZ789"),
55 factory.getWindUp(SatelliteSystem.GALILEO, 2, Dipole.CANONICAL_I_J, "XYZ789"),
56 factory.getWindUp(SatelliteSystem.GLONASS, 2, Dipole.CANONICAL_I_J, "XYZ789")
57 };
58 WindUp[] windUp2 = {
59 factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J, "ABC123"),
60 factory.getWindUp(SatelliteSystem.GLONASS, 1, Dipole.CANONICAL_I_J, "ABC123"),
61 factory.getWindUp(SatelliteSystem.GALILEO, 2, Dipole.CANONICAL_I_J, "ABC123"),
62 factory.getWindUp(SatelliteSystem.GLONASS, 2, Dipole.CANONICAL_I_J, "ABC123"),
63 factory.getWindUp(SatelliteSystem.GALILEO, 1, Dipole.CANONICAL_I_J, "XYZ789"),
64 factory.getWindUp(SatelliteSystem.GLONASS, 1, Dipole.CANONICAL_I_J, "XYZ789"),
65 factory.getWindUp(SatelliteSystem.GALILEO, 2, Dipole.CANONICAL_I_J, "XYZ789"),
66 factory.getWindUp(SatelliteSystem.GLONASS, 2, Dipole.CANONICAL_I_J, "XYZ789")
67 };
68
69 for (int i = 0; i < windUp1.length; ++i) {
70 for (int j = 0; j < windUp1.length; ++j) {
71 if (i != j) {
72 Assertions.assertNotSame(windUp1[i], windUp1[j]);
73 Assertions.assertNotSame(windUp2[i], windUp2[j]);
74 }
75 }
76 Assertions.assertSame(windUp1[i], windUp2[i]);
77 }
78
79 }
80
81 }