OSDN Git Service

green: タイムスタンプのUTCとローカル時間との表示変換機能のテストを追加
[importpicture/importpicture.git] / importPicture / test / osm / jp / gpx / ElementMapTRKPTTest.java
index 982a020..90d4a1f 100644 (file)
@@ -4,6 +4,7 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.*;
 
+import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -226,4 +227,17 @@ public class ElementMapTRKPTTest {
                        assertThat(ret, is(nullValue()));
                }
        }
+       
+       public static class タイムスタンプの書式 {
+               @Test
+               public void EXIF時刻書式テスト() throws Exception {
+               String dateTimeOriginal = "2017:06:30 09:59:59";
+               Date time = ImportPicture.toEXIFDate(dateTimeOriginal);
+               assertThat(ImportPicture.toEXIFString(time), is("2017:06:30 09:59:59"));
+               assertThat(ImportPicture.toUTCString(time), is("2017-06-30T09:59:59Z"));
+               DateFormat dfUTC = new SimpleDateFormat(ImportPicture.TIME_FORMAT_STRING);
+               assertThat(dfUTC.format(time), is("2017-06-30T18:59:59Z"));
+               }
+               
+       }
 }