Commit 508195d7 authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Improved test coverage.

parent a67a4b2d
......@@ -39,6 +39,9 @@ import org.orekit.utils.TimeStampedPVCoordinates;
*/
public class CPF implements EphemerisFile<CPF.CPFCoordinate, CPF.CPFEphemeris> {
/** Default satellite ID, used if header is null when initializing the ephemeris. */
public static final String DEFAULT_ID = "9999999";
/** Gravitational coefficient. */
private double mu;
......@@ -105,14 +108,15 @@ public class CPF implements EphemerisFile<CPF.CPFCoordinate, CPF.CPFEphemeris> {
/**
* Adds a new P/V coordinate to the satellite.
* <p>
* If the header has not been read, the {@link #DEFAULT_ID} is used.
* </p>
* @param coord the P/V coordinate of the satellite
* @deprecated as of 11.0.1, replaced by {@link #addSatelliteCoordinates(String, CPFCoordinate)}
*/
@Deprecated
public void addSatelliteCoordinate(final CPFCoordinate coord) {
final String id = header.getIlrsSatelliteId();
createIfNeeded(id);
ephemeris.get(id).coordinates.add(coord);
addSatelliteCoordinate(DEFAULT_ID, coord);
}
/**
......@@ -236,7 +240,7 @@ public class CPF implements EphemerisFile<CPF.CPFCoordinate, CPF.CPFEphemeris> {
/** {@inheritDoc} */
@Override
public String getId() {
return id == null ? header.getIlrsSatelliteId() : id;
return id == null ? DEFAULT_ID : id;
}
/** {@inheritDoc} */
......
......@@ -236,6 +236,40 @@ public class CPFWriterTest {
}
@Test
@Deprecated
public void testDefaultId() throws IOException {
// Initialize
final CPF cpf = new CPF();
// Fast check
assertEquals(0, cpf.getSatellites().size());
// Add coordinates
final int leap = 0;
cpf.addSatelliteCoordinate(new CPFCoordinate(AbsoluteDate.J2000_EPOCH, Vector3D.PLUS_I, leap));
// Verify
assertEquals(1, cpf.getSatellites().size());
}
@Test
@Deprecated
public void testOldConstructor() throws IOException {
// Initialize
// Create an empty CPF file
final CPF cpf = new CPF();
final CPFEphemeris ephemeris = cpf.new CPFEphemeris();
// Fast check
assertEquals(0, ephemeris.getCoordinates().size());
assertEquals(CPF.DEFAULT_ID, ephemeris.getId());
}
public static void compareCpfFiles(CPF file1, CPF file2) {
// Header
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment