ExifHelper { private static int getRotation(int orientation) { switch (orientation) { case 1: return 0; case 2: return 0; case 3: return 180; case 4: return 0; case 5: return 0; case 6: return 90; case 7: return 0; case 8: return 270; } return 0; }  static int getRotationBasedOnExifOrientation(Source<?> source);  }
@Test public void getRotation() { StreamSource source = StreamSource.newInstance( getClass().getResourceAsStream("/image/with_exif_orientation.JPG"), "with_exif_orientation.JPG"); int rotation = ExifHelper.getRotationBasedOnExifOrientation(source); assertEquals(90, rotation); }