@Test
public void testGetCenter() {

    LOG.info("testGetCenter");
    final GeoPoint x1 = new GeoPoint(0.0, 2.0);
    final GeoPoint y1 = new GeoPoint(10.0, 4.0);
    final GeoPoint m1 = new GeoPoint(5.0, 3.0);
    final GeoLine line1 = new GeoLine(x1, y1);
    Assert.assertEquals(m1, line1.getCenter());
    final GeoPoint x2 = new GeoPoint(-10.0, 170.0);
    final GeoPoint y2 = new GeoPoint(10.0, -175.0);
    // First check a line that is over the long side of the Earth.
    final GeoPoint shortMid = new GeoPoint(0.0, -2.5);
    final GeoLine shortSide = new GeoLine(y2, x2);
    Assert.assertEquals(shortMid, shortSide.getCenter());
    // Then over the short side.
    final GeoPoint longMid = new GeoPoint(0.0, 177.5);
    final GeoLine longSide = new GeoLine(x2, y2);
    Assert.assertEquals(longMid, longSide.getCenter());
    {
        final GeoPoint p1 = new GeoPoint(0.0, 160.0);
        final GeoPoint p2 = new GeoPoint(0.0, 170.0);
        final GeoLine p1short = new GeoLine(p1, p2);
        final GeoLine p1long = new GeoLine(p2, p1);
        final double eastingShort = p1short.getEasting();
        final double eastingLong = p1long.getEasting();
        Assert.assertTrue(eastingShort >= 0.0);
        Assert.assertTrue(eastingLong >= 0.0);
        final GeoPoint midpShort = new GeoPoint(0.0, 165.0);
        final GeoPoint midpLong = new GeoPoint(0.0, -15.0);
        Assert.assertEquals(midpShort, p1short.getCenter());
        Assert.assertEquals(midpLong, p1long.getCenter());
    }
    {
        final GeoPoint p1 = new GeoPoint(0.0, -170.0);
        final GeoPoint p2 = new GeoPoint(0.0, -160.0);
        final GeoLine p1short = new GeoLine(p1, p2);
        final GeoLine p1long = new GeoLine(p2, p1);
        final double eastingShort = p1short.getEasting();
        final double eastingLong = p1long.getEasting();
        Assert.assertTrue(eastingShort >= 0.0);
        Assert.assertTrue(eastingLong >= 0.0);
        final GeoPoint midpShort = new GeoPoint(0.0, -165.0);
        final GeoPoint midpLong = new GeoPoint(0.0, 15.0);
        Assert.assertEquals(midpShort, p1short.getCenter());
        Assert.assertEquals(midpLong, p1long.getCenter());
    }
}