Commit 024730f7 authored by Vincent CUCCHIETTI's avatar Vincent CUCCHIETTI Committed by Maxime Journot
Browse files

Migrate tests from JUnit4 to JUnit5.

Replaced dependency junit v4.13.2 with org.junit.jupiter (api and engine) v5.9.0
Added dependency to org.hamcrest (library) v2.2
Replaced all Junit4 assertions with their JUnit5 counterparts
Removed shared resources between DragForceTest and TimeSpanDragForceTest (luc)

Fixes #956.
parent 41a066c9
......@@ -7,3 +7,5 @@ target
/build
/lib
*.class
.idea/
orekit.iml
\ No newline at end of file
......@@ -51,7 +51,8 @@
<orekit.mathjax.config>&lt;script type=&quot;text/x-mathjax-config&quot;&gt;MathJax.Hub.Config({ TeX: { extensions: [&quot;autoload.js&quot;]}});&lt;/script&gt;</orekit.mathjax.config>
<orekit.mathjax.enable>&lt;script type=&quot;text/javascript&quot; src=&quot;https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_CHTML&quot;&gt;&lt;/script&gt;</orekit.mathjax.enable>
<orekit.hipparchus.version>2.1</orekit.hipparchus.version>
<orekit.junit.version>4.13.2</orekit.junit.version>
<orekit.junit.version>5.9.0</orekit.junit.version>
<orekit.hamcrest.version>2.2</orekit.hamcrest.version>
<orekit.compiler.source>1.8</orekit.compiler.source>
<orekit.compiler.target>1.8</orekit.compiler.target>
<orekit.implementation.build>${git.revision}; ${maven.build.timestamp}</orekit.implementation.build>
......@@ -399,12 +400,25 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${orekit.junit.version}</version>
<type>jar</type>
<optional>false</optional>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${orekit.junit.version}</version>
<optional>false</optional>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${orekit.hamcrest.version}</version>
<optional>false</optional>
<scope>test</scope>
</dependency>
</dependencies>
......
......@@ -27,6 +27,9 @@
<action dev="bryan" type="add" issue="901">
Added additional state provider for covariance matrix propagation.
</action>
<action dev="vincent" type="update" issue="956">
Migrated all tests from JUnit4 to JUnit5.
</action>
<action dev="evan" type="add">
Added constructor to AggregateBoundedPropagator for more control over which
propagator is used.
......
......@@ -16,6 +16,19 @@
*/
package org.orekit;
import org.hipparchus.exception.DummyLocalizable;
import org.hipparchus.exception.Localizable;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.util.FastMath;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.frames.Predefined;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeComponents;
import org.orekit.time.TimeScale;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
......@@ -30,19 +43,6 @@ import java.util.NoSuchElementException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.hipparchus.exception.DummyLocalizable;
import org.hipparchus.exception.Localizable;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.util.FastMath;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.frames.Predefined;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeComponents;
import org.orekit.time.TimeScale;
/** Simple parser for key/value files.
* @param Key type of the parameter keys
*/
......@@ -327,7 +327,6 @@ public class KeyValueFileParser<Key extends Enum<Key>> {
* @param xKey parameter key for abscissa
* @param yKey parameter key for ordinate
* @param zKey parameter key for height
* @param scale time scale in which the date is to be parsed
* @return date value corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
......@@ -340,7 +339,6 @@ public class KeyValueFileParser<Key extends Enum<Key>> {
* @param xKey parameter key for abscissa
* @param yKey parameter key for ordinate
* @param zKey parameter key for height
* @param scale time scale in which the date is to be parsed
* @return date value corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
......@@ -422,7 +420,6 @@ public class KeyValueFileParser<Key extends Enum<Key>> {
* We consider Earth frames are the frames with name starting with "ITRF".
* </p>
* @param key parameter key
* @param parameters key/value map containing the parameters
* @return Earth frame corresponding to the key
* @exception NoSuchElementException if key is not in the map
*/
......
......@@ -16,10 +16,6 @@
*/
package org.orekit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.SelfDescribing;
......@@ -35,6 +31,10 @@ import org.orekit.time.AbsoluteDate;
import org.orekit.utils.Constants;
import org.orekit.utils.PVCoordinates;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import static org.hamcrest.CoreMatchers.is;
/**
......
......@@ -16,6 +16,16 @@
*/
package org.orekit;
import org.hipparchus.exception.DummyLocalizable;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.models.earth.atmosphere.DTM2000InputParameters;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.ChronologicalComparator;
import org.orekit.time.TimeScalesFactory;
import org.orekit.time.TimeStamped;
import org.orekit.utils.Constants;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
......@@ -27,16 +37,6 @@ import java.util.SortedSet;
import java.util.TimeZone;
import java.util.TreeSet;
import org.hipparchus.exception.DummyLocalizable;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.models.earth.atmosphere.DTM2000InputParameters;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.ChronologicalComparator;
import org.orekit.time.TimeScalesFactory;
import org.orekit.time.TimeStamped;
import org.orekit.utils.Constants;
/** This class reads and provides solar activity data needed by the
* two atmospheric models. The data are furnished at the <a
......
......@@ -16,16 +16,7 @@
*/
package org.orekit;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;
import org.orekit.attitudes.AttitudeProvider;
import org.orekit.attitudes.InertialProvider;
import org.orekit.bodies.CelestialBodyFactory;
......@@ -52,6 +43,15 @@ import org.orekit.time.TimeScalesFactory;
import org.orekit.utils.Constants;
import org.orekit.utils.IERSConventions;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.concurrent.atomic.AtomicReference;
public class Utils {
// epsilon for tests
......@@ -129,7 +129,7 @@ public class Utils {
}
}
} catch (IllegalAccessException iae) {
Assert.fail(iae.getMessage());
Assertions.fail(iae.getMessage());
}
}
......@@ -143,7 +143,7 @@ public class Utils {
}
}
} catch (IllegalAccessException iae) {
Assert.fail(iae.getMessage());
Assertions.fail(iae.getMessage());
}
}
......@@ -157,7 +157,7 @@ public class Utils {
}
}
} catch (IllegalAccessException iae) {
Assert.fail(iae.getMessage());
Assertions.fail(iae.getMessage());
}
}
......
......@@ -16,16 +16,14 @@
*/
package org.orekit.attitudes;
import java.util.Collections;
import org.hipparchus.Field;
import org.hipparchus.CalculusFieldElement;
import org.hipparchus.Field;
import org.hipparchus.geometry.euclidean.threed.FieldRotation;
import org.hipparchus.geometry.euclidean.threed.Rotation;
import org.hipparchus.util.Decimal64Field;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.orekit.Utils;
import org.orekit.data.DataSource;
import org.orekit.errors.OrekitException;
......@@ -37,9 +35,11 @@ import org.orekit.time.AbsoluteDate;
import org.orekit.time.FieldAbsoluteDate;
import org.orekit.time.TimeScalesFactory;
import java.util.Collections;
public class AggregateBoundedAttitudeProviderTest {
@Before
@BeforeEach
public void setUp() {
Utils.setDataRoot("regular-data:ccsds");
}
......@@ -49,7 +49,7 @@ public class AggregateBoundedAttitudeProviderTest {
try {
new AggregateBoundedAttitudeProvider(Collections.emptyList());
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.NOT_ENOUGH_ATTITUDE_PROVIDERS, oe.getSpecifier());
Assertions.assertEquals(OrekitMessages.NOT_ENOUGH_ATTITUDE_PROVIDERS, oe.getSpecifier());
}
}
......@@ -64,18 +64,18 @@ public class AggregateBoundedAttitudeProviderTest {
final BoundedAttitudeProvider provider = ephemeris.getAttitudeProvider();
// Verify dates
Assert.assertEquals(0.0, provider.getMinDate().durationFrom(ephemeris.getStart()), 1.0e-10);
Assert.assertEquals(0.0, provider.getMaxDate().durationFrom(ephemeris.getStop()), 1.0e-10);
Assert.assertEquals(0.0, provider.getMinDate().durationFrom(ephemeris.getSegments().get(0).getStart()), 1.0e-10);
Assert.assertEquals(0.0, provider.getMaxDate().durationFrom(ephemeris.getSegments().get(1).getStop()), 1.0e-10);
Assertions.assertEquals(0.0, provider.getMinDate().durationFrom(ephemeris.getStart()), 1.0e-10);
Assertions.assertEquals(0.0, provider.getMaxDate().durationFrom(ephemeris.getStop()), 1.0e-10);
Assertions.assertEquals(0.0, provider.getMinDate().durationFrom(ephemeris.getSegments().get(0).getStart()), 1.0e-10);
Assertions.assertEquals(0.0, provider.getMaxDate().durationFrom(ephemeris.getSegments().get(1).getStop()), 1.0e-10);
// Verify computation with data in first segment
Attitude attitude = provider.getAttitude(null, new AbsoluteDate("1996-11-28T22:08:04.555", TimeScalesFactory.getUTC()), null);
Rotation rotation = attitude.getRotation();
Assert.assertEquals(0.45652, rotation.getQ0(), 0.00001);
Assert.assertEquals(-0.84532, rotation.getQ1(), 0.00001);
Assert.assertEquals(0.26974, rotation.getQ2(), 0.00001);
Assert.assertEquals(-0.06532, rotation.getQ3(), 0.00001);
Assertions.assertEquals(0.45652, rotation.getQ0(), 0.00001);
Assertions.assertEquals(-0.84532, rotation.getQ1(), 0.00001);
Assertions.assertEquals(0.26974, rotation.getQ2(), 0.00001);
Assertions.assertEquals(-0.06532, rotation.getQ3(), 0.00001);
}
......@@ -94,18 +94,18 @@ public class AggregateBoundedAttitudeProviderTest {
final BoundedAttitudeProvider provider = ephemeris.getAttitudeProvider();
// Verify dates
Assert.assertEquals(0.0, provider.getMinDate().durationFrom(ephemeris.getStart()), 1.0e-10);
Assert.assertEquals(0.0, provider.getMaxDate().durationFrom(ephemeris.getStop()), 1.0e-10);
Assert.assertEquals(0.0, provider.getMinDate().durationFrom(ephemeris.getSegments().get(0).getStart()), 1.0e-10);
Assert.assertEquals(0.0, provider.getMaxDate().durationFrom(ephemeris.getSegments().get(1).getStop()), 1.0e-10);
Assertions.assertEquals(0.0, provider.getMinDate().durationFrom(ephemeris.getStart()), 1.0e-10);
Assertions.assertEquals(0.0, provider.getMaxDate().durationFrom(ephemeris.getStop()), 1.0e-10);
Assertions.assertEquals(0.0, provider.getMinDate().durationFrom(ephemeris.getSegments().get(0).getStart()), 1.0e-10);
Assertions.assertEquals(0.0, provider.getMaxDate().durationFrom(ephemeris.getSegments().get(1).getStop()), 1.0e-10);
// Verify computation with data in first segment
FieldAttitude<T> attitude = provider.getAttitude(null, new FieldAbsoluteDate<>(new AbsoluteDate("1996-11-28T22:08:04.555", TimeScalesFactory.getUTC()), field.getZero()), null);
FieldRotation<T> rotation = attitude.getRotation();
Assert.assertEquals(0.45652, rotation.getQ0().getReal(), 0.00001);
Assert.assertEquals(-0.84532, rotation.getQ1().getReal(), 0.00001);
Assert.assertEquals(0.26974, rotation.getQ2().getReal(), 0.00001);
Assert.assertEquals(-0.06532, rotation.getQ3().getReal(), 0.00001);
Assertions.assertEquals(0.45652, rotation.getQ0().getReal(), 0.00001);
Assertions.assertEquals(-0.84532, rotation.getQ1().getReal(), 0.00001);
Assertions.assertEquals(0.26974, rotation.getQ2().getReal(), 0.00001);
Assertions.assertEquals(-0.06532, rotation.getQ3().getReal(), 0.00001);
}
......@@ -123,14 +123,14 @@ public class AggregateBoundedAttitudeProviderTest {
try {
provider.getAttitude(null, provider.getMinDate().shiftedBy(-60.0), null);
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_GENERATE_NEW_DATA_BEFORE, oe.getSpecifier());
Assertions.assertEquals(OrekitMessages.UNABLE_TO_GENERATE_NEW_DATA_BEFORE, oe.getSpecifier());
}
// after bound of last attitude provider
try {
provider.getAttitude(null, provider.getMaxDate().shiftedBy(60.0), null);
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_GENERATE_NEW_DATA_AFTER, oe.getSpecifier());
Assertions.assertEquals(OrekitMessages.UNABLE_TO_GENERATE_NEW_DATA_AFTER, oe.getSpecifier());
}
}
......@@ -153,14 +153,14 @@ public class AggregateBoundedAttitudeProviderTest {
try {
provider.getAttitude(null, new FieldAbsoluteDate<>(provider.getMinDate(), field.getZero().subtract(60.0)), null);
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_GENERATE_NEW_DATA_BEFORE, oe.getSpecifier());
Assertions.assertEquals(OrekitMessages.UNABLE_TO_GENERATE_NEW_DATA_BEFORE, oe.getSpecifier());
}
// after bound of last attitude provider
try {
provider.getAttitude(null, new FieldAbsoluteDate<>(provider.getMinDate(), field.getZero().add(60.0)), null);
} catch (OrekitException oe) {
Assert.assertEquals(OrekitMessages.UNABLE_TO_GENERATE_NEW_DATA_AFTER, oe.getSpecifier());
Assertions.assertEquals(OrekitMessages.UNABLE_TO_GENERATE_NEW_DATA_AFTER, oe.getSpecifier());
}
}
......
......@@ -16,15 +16,11 @@
*/
package org.orekit.attitudes;
import java.util.ArrayList;
import java.util.List;
import org.hipparchus.geometry.euclidean.threed.Rotation;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.util.FastMath;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.orekit.Utils;
import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.frames.FramesFactory;
......@@ -36,6 +32,9 @@ import org.orekit.utils.Constants;
import org.orekit.utils.IERSConventions;
import org.orekit.utils.PVCoordinates;
import java.util.ArrayList;
import java.util.List;
public class AttitudeTest {
@Test
......@@ -43,12 +42,12 @@ public class AttitudeTest {
Attitude attitude = new Attitude(AbsoluteDate.J2000_EPOCH, FramesFactory.getEME2000(),
new Rotation(0.48, 0.64, 0.36, 0.48, false),
Vector3D.ZERO, Vector3D.ZERO);
Assert.assertEquals(Vector3D.ZERO, attitude.getSpin());
Assertions.assertEquals(Vector3D.ZERO, attitude.getSpin());
double dt = 10.0;
Attitude shifted = attitude.shiftedBy(dt);
Assert.assertEquals(Vector3D.ZERO, shifted.getRotationAcceleration());
Assert.assertEquals(Vector3D.ZERO, shifted.getSpin());
Assert.assertEquals(0.0, Rotation.distance(attitude.getRotation(), shifted.getRotation()), 1.0e-15);
Assertions.assertEquals(Vector3D.ZERO, shifted.getRotationAcceleration());
Assertions.assertEquals(Vector3D.ZERO, shifted.getSpin());
Assertions.assertEquals(0.0, Rotation.distance(attitude.getRotation(), shifted.getRotation()), 1.0e-15);
}
@Test
......@@ -57,19 +56,19 @@ public class AttitudeTest {
Attitude attitude = new Attitude(AbsoluteDate.J2000_EPOCH, FramesFactory.getEME2000(),
Rotation.IDENTITY,
new Vector3D(rate, Vector3D.PLUS_K), Vector3D.ZERO);
Assert.assertEquals(rate, attitude.getSpin().getNorm(), 1.0e-10);
Assertions.assertEquals(rate, attitude.getSpin().getNorm(), 1.0e-10);
double dt = 10.0;
double alpha = rate * dt;
Attitude shifted = attitude.shiftedBy(dt);
Assert.assertEquals(rate, shifted.getSpin().getNorm(), 1.0e-10);
Assert.assertEquals(alpha, Rotation.distance(attitude.getRotation(), shifted.getRotation()), 1.0e-10);
Assertions.assertEquals(rate, shifted.getSpin().getNorm(), 1.0e-10);
Assertions.assertEquals(alpha, Rotation.distance(attitude.getRotation(), shifted.getRotation()), 1.0e-10);
Vector3D xSat = shifted.getRotation().applyInverseTo(Vector3D.PLUS_I);
Assert.assertEquals(0.0, xSat.subtract(new Vector3D(FastMath.cos(alpha), FastMath.sin(alpha), 0)).getNorm(), 1.0e-10);
Assertions.assertEquals(0.0, xSat.subtract(new Vector3D(FastMath.cos(alpha), FastMath.sin(alpha), 0)).getNorm(), 1.0e-10);
Vector3D ySat = shifted.getRotation().applyInverseTo(Vector3D.PLUS_J);
Assert.assertEquals(0.0, ySat.subtract(new Vector3D(-FastMath.sin(alpha), FastMath.cos(alpha), 0)).getNorm(), 1.0e-10);
Assertions.assertEquals(0.0, ySat.subtract(new Vector3D(-FastMath.sin(alpha), FastMath.cos(alpha), 0)).getNorm(), 1.0e-10);
Vector3D zSat = shifted.getRotation().applyInverseTo(Vector3D.PLUS_K);
Assert.assertEquals(0.0, zSat.subtract(Vector3D.PLUS_K).getNorm(), 1.0e-10);
Assertions.assertEquals(0.0, zSat.subtract(Vector3D.PLUS_K).getNorm(), 1.0e-10);
}
......@@ -79,11 +78,11 @@ public class AttitudeTest {
Attitude attitude = new Attitude(AbsoluteDate.J2000_EPOCH, FramesFactory.getEME2000(),
new Rotation(0.48, 0.64, 0.36, 0.48, false),
new Vector3D(rate, Vector3D.PLUS_K), Vector3D.ZERO);
Assert.assertEquals(rate, attitude.getSpin().getNorm(), 1.0e-10);
Assertions.assertEquals(rate, attitude.getSpin().getNorm(), 1.0e-10);
double dt = 10.0;
Attitude shifted = attitude.shiftedBy(dt);
Assert.assertEquals(rate, shifted.getSpin().getNorm(), 1.0e-10);
Assert.assertEquals(rate * dt, Rotation.distance(attitude.getRotation(), shifted.getRotation()), 1.0e-10);
Assertions.assertEquals(rate, shifted.getSpin().getNorm(), 1.0e-10);
Assertions.assertEquals(rate * dt, Rotation.distance(attitude.getRotation(), shifted.getRotation()), 1.0e-10);
Vector3D shiftedX = shifted.getRotation().applyInverseTo(Vector3D.PLUS_I);
Vector3D shiftedY = shifted.getRotation().applyInverseTo(Vector3D.PLUS_J);
......@@ -91,21 +90,21 @@ public class AttitudeTest {
Vector3D originalX = attitude.getRotation().applyInverseTo(Vector3D.PLUS_I);
Vector3D originalY = attitude.getRotation().applyInverseTo(Vector3D.PLUS_J);
Vector3D originalZ = attitude.getRotation().applyInverseTo(Vector3D.PLUS_K);
Assert.assertEquals( FastMath.cos(rate * dt), Vector3D.dotProduct(shiftedX, originalX), 1.0e-10);
Assert.assertEquals( FastMath.sin(rate * dt), Vector3D.dotProduct(shiftedX, originalY), 1.0e-10);
Assert.assertEquals( 0.0, Vector3D.dotProduct(shiftedX, originalZ), 1.0e-10);
Assert.assertEquals(-FastMath.sin(rate * dt), Vector3D.dotProduct(shiftedY, originalX), 1.0e-10);
Assert.assertEquals( FastMath.cos(rate * dt), Vector3D.dotProduct(shiftedY, originalY), 1.0e-10);
Assert.assertEquals( 0.0, Vector3D.dotProduct(shiftedY, originalZ), 1.0e-10);
Assert.assertEquals( 0.0, Vector3D.dotProduct(shiftedZ, originalX), 1.0e-10);
Assert.assertEquals( 0.0, Vector3D.dotProduct(shiftedZ, originalY), 1.0e-10);
Assert.assertEquals( 1.0, Vector3D.dotProduct(shiftedZ, originalZ), 1.0e-10);
Assertions.assertEquals( FastMath.cos(rate * dt), Vector3D.dotProduct(shiftedX, originalX), 1.0e-10);
Assertions.assertEquals( FastMath.sin(rate * dt), Vector3D.dotProduct(shiftedX, originalY), 1.0e-10);
Assertions.assertEquals( 0.0, Vector3D.dotProduct(shiftedX, originalZ), 1.0e-10);
Assertions.assertEquals(-FastMath.sin(rate * dt), Vector3D.dotProduct(shiftedY, originalX), 1.0e-10);
Assertions.assertEquals( FastMath.cos(rate * dt), Vector3D.dotProduct(shiftedY, originalY), 1.0e-10);
Assertions.assertEquals( 0.0, Vector3D.dotProduct(shiftedY, originalZ), 1.0e-10);
Assertions.assertEquals( 0.0, Vector3D.dotProduct(shiftedZ, originalX), 1.0e-10);
Assertions.assertEquals( 0.0, Vector3D.dotProduct(shiftedZ, originalY), 1.0e-10);
Assertions.assertEquals( 1.0, Vector3D.dotProduct(shiftedZ, originalZ), 1.0e-10);
Vector3D forward = AngularCoordinates.estimateRate(attitude.getRotation(), shifted.getRotation(), dt);
Assert.assertEquals(0.0, forward.subtract(attitude.getSpin()).getNorm(), 1.0e-10);
Assertions.assertEquals(0.0, forward.subtract(attitude.getSpin()).getNorm(), 1.0e-10);
Vector3D reversed = AngularCoordinates.estimateRate(shifted.getRotation(), attitude.getRotation(), dt);
Assert.assertEquals(0.0, reversed.add(attitude.getSpin()).getNorm(), 1.0e-10);
Assertions.assertEquals(0.0, reversed.add(attitude.getSpin()).getNorm(), 1.0e-10);
}
......@@ -162,10 +161,10 @@ public class AttitudeTest {
maxShiftRateError = FastMath.max(maxShiftRateError, shiftRateError);
maxInterpolationRateError = FastMath.max(maxInterpolationRateError, interpolationRateError);
}
Assert.assertTrue(maxShiftAngleError > 4.0e-6);
Assert.assertTrue(maxInterpolationAngleError < 1.5e-13);
Assert.assertTrue(maxShiftRateError > 6.0e-8);
Assert.assertTrue(maxInterpolationRateError < 2.5e-14);
Assertions.assertTrue(maxShiftAngleError > 4.0e-6);
Assertions.assertTrue(maxInterpolationAngleError < 1.5e-13);
Assertions.assertTrue(maxShiftRateError > 6.0e-8);
Assertions.assertTrue(maxInterpolationRateError < 2.5e-14);
// past sample end, interpolation error should increase, but still be far better than quadratic shift
maxShiftAngleError = 0;
......@@ -188,10 +187,10 @@ public class AttitudeTest {
maxShiftRateError = FastMath.max(maxShiftRateError, shiftRateError);
maxInterpolationRateError = FastMath.max(maxInterpolationRateError, interpolationRateError);
}
Assert.assertTrue(maxShiftAngleError > 9.0e-6);
Assert.assertTrue(maxInterpolationAngleError < 6.0e-11);
Assert.assertTrue(maxShiftRateError > 9.0e-8);
Assert.assertTrue(maxInterpolationRateError < 4.0e-12);
Assertions.assertTrue(maxShiftAngleError > 9.0e-6);
Assertions.assertTrue(maxInterpolationAngleError < 6.0e-11);
Assertions.assertTrue(maxShiftRateError > 9.0e-8);
Assertions.assertTrue(maxInterpolationRateError < 4.0e-12);
}
......
......@@ -16,12 +16,8 @@
*/
package org.orekit.attitudes;
import java.util.ArrayList;
import java.util.List;
import org.hipparchus.Field;
import org.hipparchus.CalculusFieldElement;
import org.hipparchus.Field;
import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
import org.hipparchus.geometry.euclidean.threed.Rotation;
import org.hipparchus.geometry.euclidean.threed.RotationOrder;
......@@ -31,9 +27,9 @@ import org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator;
import org.hipparchus.ode.nonstiff.DormandPrince853Integrator;
import org.hipparchus.util.Decimal64Field;
import org.hipparchus.util.FastMath;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.orekit.Utils;
import org.orekit.bodies.CelestialBodyFactory;
import org.orekit.bodies.GeodeticPoint;
......@@ -76,6 +72,9 @@ import org.orekit.utils.IERSConventions;
import org.orekit.utils.PVCoordinates;
import org.orekit.utils.PVCoordinatesProvider;
import java.util.ArrayList;
import java.util.List;
public class AttitudesSequenceTest {
private AbsoluteDate lastChange;
......@@ -155,16 +154,16 @@ public class AttitudesSequenceTest {
if (currentState.getDate().durationFrom(lastChange) > 300) {
if (inEclipse) {
Assert.assertTrue(eclipseAngle <= 0);
Assert.assertEquals(0.0, pointingOffset, 1.0e-6);
Assertions.assertTrue(eclipseAngle <= 0);
Assertions.assertEquals(0.0, pointingOffset, 1.0e-6);
} else {
Assert.assertTrue(eclipseAngle >= 0);
Assert.assertEquals(0.767215, pointingOffset, 1.0e-6);
Assertions.assertTrue(eclipseAngle >= 0);
Assertions.assertEquals(0.767215, pointingOffset, 1.0e-6);
}
} else {
// we are in transition
Assert.assertTrue(pointingOffset + " " + (0.767215 - pointingOffset),
pointingOffset <= 0.7672155);
Assertions.assertTrue(pointingOffset <= 0.7672155,
pointingOffset + " " + (0.767215 - pointingOffset));
}
}
});
......@@ -175,11 +174,11 @@ public class AttitudesSequenceTest {
// as we have 2 switch events (even if they share the same underlying event detector),
// and these events are triggered at both eclipse entry and exit, we get 8
// raw events on 2 orbits
Assert.assertEquals(8, logger.getLoggedEvents().size());
Assertions.assertEquals(8, logger.getLoggedEvents().size());
// we have 4 attitudes switch on 2 orbits, 2 of each type
Assert.assertEquals(2, dayToNightHandler.dates.size());