### Question:
Position { public final Position ensureContinuous(Position lastPosition) { double lon = this.lon; if (abs(lon - lastPosition.lon) > 180) { if (lastPosition.lon < 0) lon -= 360; else lon += 360; return new Position(lat, lon); } else return this; } Position(double lat, double lon);  Position(double lat, double lon, double alt); static Position create(double lat, double lon); static Position create(double lat, double lon, double alt); final double getLat(); final double getLon(); final double getAlt(); @Override final String toString(); final Position predict(double distanceKm, double courseDegrees); static double toDegrees(double degrees, double minutes,
			double seconds); Double getLatitudeOnGreatCircle(Position position,
			double longitudeDegrees); LongitudePair getLongitudeOnGreatCircle(Position position,
			double latitudeDegrees); final Position[] getEarthLimb(int radials); final double getDistanceToKm(Position position); final double getBearingDegrees(Position position); static double getBearingDifferenceDegrees(double bearing1,
			double bearing2); final double getDistanceKmToPath(Position p1, Position p2); static String toDegreesMinutesDecimalMinutesLatitude(double lat); static String toDegreesMinutesDecimalMinutesLongitude(double lon); static void assertWithMsg(boolean assertion, String msg); final Position getPositionAlongPath(Position position,
			double proportion); final List<Position> getPositionsAlongPath(Position position,
			double maxSegmentLengthKm); final Position to360(); final Position ensureContinuous(Position lastPosition); final boolean isWithin(List<Position> positions); @Override final boolean equals(Object o); @Override final int hashCode(); final double getDistanceToPathKm(List<Position> positions); final double getDistanceToSegmentKm(Position p1, Position p2); final Position getClosestIntersectionWithSegment(Position p1,
			Position p2); boolean isOutside(List<Position> path, double minDistanceKm); static double longitudeDiff(double a, double b); static double to180(double d); Position normalizeLongitude();  }### Answer:
@Test public final void testEnsureContinuous() { { Position a = new Position(-35, 179); Position b = new Position(-35, -178); Position c = b.ensureContinuous(a); Assert.assertEquals(182, c.getLon(), 0.0001); Assert.assertEquals(b.getLat(), c.getLat(), 0.0001); } { Position a = new Position(-35, -2); Position b = new Position(-35, 360); Position c = b.ensureContinuous(a); Assert.assertEquals(0, c.getLon(), 0.0001); } }