예제 #1
0
  @Test
  public void testSerialization() throws OrekitException, IOException, ClassNotFoundException {
    OneAxisEllipsoid original =
        new OneAxisEllipsoid(
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING,
            FramesFactory.getITRFEquinox(IERSConventions.IERS_1996, true));
    original.setAngularThreshold(1.0e-3);

    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(original);
    Assert.assertTrue(bos.size() > 250);
    Assert.assertTrue(bos.size() < 350);

    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bis);
    OneAxisEllipsoid deserialized = (OneAxisEllipsoid) ois.readObject();
    Assert.assertEquals(
        original.getEquatorialRadius(), deserialized.getEquatorialRadius(), 1.0e-12);
    Assert.assertEquals(original.getFlattening(), deserialized.getFlattening(), 1.0e-12);
  }