@Test
  public void testVersionAndModelTiePoint() {
    metadata.addModelTiePoint(1, 2, 3, 4, 5, 6);
    metadata.addModelTiePoint(2, 3, 4, 5, 6, 7);
    metadata.addModelTiePoint(3, 4, 5, 6, 7, 8);
    final List<TIFFField> list = Utils.createGeoTIFFFields(metadata);

    assertNotNull(list);
    assertEquals(2, list.size());

    final TIFFField dirField = list.get(0);
    assertEquals(GeoTIFFTagSet.TAG_GEO_KEY_DIRECTORY, dirField.getTag());
    assertEquals(TIFFField.TIFF_SHORT, dirField.getType());
    assertEquals(4, dirField.getCount());
    assertArrayEquals(new char[] {1, 1, 2, 0}, dirField.getAsChars());

    final TIFFField tiePointField = list.get(1);
    assertEquals(GeoTIFFTagSet.TAG_MODEL_TIE_POINT, tiePointField.getTag());
    assertEquals(TIFFField.TIFF_DOUBLE, tiePointField.getType());
    assertEquals(3 * 6, tiePointField.getCount());
    final double[] expected = {
      1, 2, 3, 4, 5, 6,
      2, 3, 4, 5, 6, 7,
      3, 4, 5, 6, 7, 8
    };
    assertEquals(true, Arrays.equals(expected, tiePointField.getAsDoubles()));
  }
  @Test
  public void testThreeGeoTIFFTagsWithOneDouble() {
    metadata.addGeoShortParam(2300, 4576);
    metadata.addGeoDoubleParam(2400, 4.5);
    metadata.addGeoShortParam(2401, 3456);

    final List<TIFFField> list = Utils.createGeoTIFFFields(metadata);

    assertNotNull(list);
    assertEquals(2, list.size());

    final TIFFField dirField = list.get(0);
    final TIFFField doubleField = list.get(1);

    assertEquals(GeoTIFFTagSet.TAG_GEO_KEY_DIRECTORY, dirField.getTag());
    assertEquals(GeoTIFFTagSet.TAG_GEO_DOUBLE_PARAMS, doubleField.getTag());

    assertEquals(TIFFField.TIFF_SHORT, dirField.getType());
    assertEquals(TIFFField.TIFF_DOUBLE, doubleField.getType());

    assertEquals(16, dirField.getCount());
    assertEquals(1, doubleField.getCount());

    final char[] expected = {
      1, 1, 2, 3,
      2300, 0, 1, 4576,
      2400, GeoTIFFTagSet.TAG_GEO_DOUBLE_PARAMS, 1, 0,
      2401, 0, 1, 3456
    };
    assertArrayEquals(expected, dirField.getAsChars());
    assertEquals(true, Arrays.equals(new double[] {4.5}, doubleField.getAsDoubles()));
  }
  @Test
  public void testVersionAndModelPixelScale() {
    metadata.setModelPixelScale(1, 2, 3);
    final List<TIFFField> list = Utils.createGeoTIFFFields(metadata);

    assertNotNull(list);
    assertEquals(2, list.size());

    final TIFFField dirField = list.get(0);
    assertEquals(GeoTIFFTagSet.TAG_GEO_KEY_DIRECTORY, dirField.getTag());
    assertEquals(TIFFField.TIFF_SHORT, dirField.getType());
    assertEquals(4, dirField.getCount());
    assertArrayEquals(new char[] {1, 1, 2, 0}, dirField.getAsChars());

    final TIFFField scaleField = list.get(1);
    assertEquals(GeoTIFFTagSet.TAG_MODEL_PIXEL_SCALE, scaleField.getTag());
    assertEquals(TIFFField.TIFF_DOUBLE, scaleField.getType());
    assertEquals(3, scaleField.getCount());
    assertEquals(true, Arrays.equals(new double[] {1, 2, 3}, scaleField.getAsDoubles()));
  }
  @Test
  public void testVersionAndModelTransformation() {
    metadata.setModelTransformation(
        new double[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16});
    final List<TIFFField> list = Utils.createGeoTIFFFields(metadata);

    assertNotNull(list);
    assertEquals(2, list.size());

    final TIFFField dirField = list.get(0);
    assertEquals(GeoTIFFTagSet.TAG_GEO_KEY_DIRECTORY, dirField.getTag());
    assertEquals(TIFFField.TIFF_SHORT, dirField.getType());
    assertEquals(4, dirField.getCount());
    assertArrayEquals(new char[] {1, 1, 2, 0}, dirField.getAsChars());

    final TIFFField transformField = list.get(1);
    assertEquals(GeoTIFFTagSet.TAG_MODEL_TRANSFORMATION, transformField.getTag());
    assertEquals(TIFFField.TIFF_DOUBLE, transformField.getType());
    assertEquals(16, transformField.getCount());
    final double[] expected = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
    assertEquals(true, Arrays.equals(expected, transformField.getAsDoubles()));
  }