@Test
public void testToLonLat() {

  List<Vector> vectors = new ArrayList<>();
  // lon lat
  vectors.add(new BasicVector(new double[] {-30, 30})); // upper left
  vectors.add(new BasicVector(new double[] {30, 30})); // upper right
  vectors.add(new BasicVector(new double[] {30, -30})); // lower right
  vectors.add(new BasicVector(new double[] {-30, -30})); // lower left
  CoordinateConverter coordinateConverter = new CoordinateConverter(1024, 768, vectors);
  /*
   *    0,0                                  1024,0
   *
   *         1024/3,768/3     2*1024/3,768/3
   *
   *
   *         1024/3,2*768/3   2*1024/3,2*768/3
   *
   *    0,768                                1024,768
   */
  /*
   *    -30,30                                  30,30
   *
   *             -10,10              10,10
   *
   *
   *             -10,-10             10,-10
   *
   *    -30,-30                                30,-30
   */
  List<Vector> pixels = new LinkedList<>();
  pixels.add(new BasicVector(new double[] {1024 / 3, 768 / 3}));
  pixels.add(new BasicVector(new double[] {2 * 1024 / 3, 768 / 3}));
  pixels.add(new BasicVector(new double[] {2 * 1024 / 3, 2 * 768 / 3}));
  pixels.add(new BasicVector(new double[] {1024 / 3, 2 * 768 / 3}));
  List<Vector> newLatLong = coordinateConverter.toLonLat(pixels);
  double xOneThird = 60.0 * (341.0 / 1024.0);
  double xTwoThirds = 60.0 * (682.0 / 1024.0);
  double yOneThird = 60.0 * (256.0 / 768.0);
  double yTwoThirds = 60.0 * (512.0 / 768.0);
  assertThat(newLatLong.get(0).get(0), Matchers.closeTo(-30 + xOneThird, 0.01));
  assertThat(newLatLong.get(0).get(1), Matchers.closeTo(-30 + yTwoThirds, 0.01));
  assertThat(newLatLong.get(1).get(0), Matchers.closeTo(-30 + xTwoThirds, 0.01));
  assertThat(newLatLong.get(1).get(1), Matchers.closeTo(-30 + yTwoThirds, 0.01));
  assertThat(newLatLong.get(2).get(0), Matchers.closeTo(-30 + xTwoThirds, 0.01));
  assertThat(newLatLong.get(2).get(1), Matchers.closeTo(-30 + yOneThird, 0.01));
  assertThat(newLatLong.get(3).get(0), Matchers.closeTo(-30 + xOneThird, 0.01));
  assertThat(newLatLong.get(3).get(1), Matchers.closeTo(-30 + yOneThird, 0.01));
}