diff --git a/.gitignore b/.gitignore index 2cab4bd..4cfd2c6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ /src/test/data/*.log /src/test/data/cameradata/ /src/test/data/output +!/src/test/data/*.tar.gz nb*.xml Thumbs.db /nbproject/ diff --git a/src/test/java/osm/jp/gpx/AppParametersTest.java b/src/test/java/osm/jp/gpx/AppParametersTest.java index 3b3959c..686a249 100644 --- a/src/test/java/osm/jp/gpx/AppParametersTest.java +++ b/src/test/java/osm/jp/gpx/AppParametersTest.java @@ -124,7 +124,7 @@ } } - static void delTestData(String filename) { + public static void delTestData(String filename) { File iniFile = new File(filename); if (iniFile.exists()) { iniFile.delete(); diff --git a/src/test/java/osm/jp/gpx/ElementMapTRKSEGTest.java b/src/test/java/osm/jp/gpx/ElementMapTRKSEGTest.java index 24b152d..f00436d 100644 --- a/src/test/java/osm/jp/gpx/ElementMapTRKSEGTest.java +++ b/src/test/java/osm/jp/gpx/ElementMapTRKSEGTest.java @@ -55,14 +55,14 @@ @After public void tearDown() throws Exception { - AppParametersTest.delTestData("AdjustTime.ini"); + osm.jp.gpx.AppParametersTest.delTestData("AdjustTime.ini"); } @Theory public void TRKSEGを読み込む(Fixture dataset) { try { System.out.println("GPX file: "+ dataset.gpxSourcePath); - GpxFile gpx = new GpxFile(new AppParameters(AppParameters.FILE_PATH), new File(dataset.gpxSourcePath)); + GpxFile gpx = new GpxFile(new AppParameters(), new File(dataset.gpxSourcePath)); gpx.parse(); assertThat(gpx.gpx.trkseg.size(), is(dataset.segCount)); for (Date key : gpx.gpx.trkseg.keySet()) { diff --git a/src/test/java/osm/jp/gpx/Fixture.java b/src/test/java/osm/jp/gpx/Fixture.java index bc20a28..1f8633b 100644 --- a/src/test/java/osm/jp/gpx/Fixture.java +++ b/src/test/java/osm/jp/gpx/Fixture.java @@ -42,7 +42,7 @@ /** * ユニットテスト用データ * [Canonカメラ] - */ + * @DataPoints public static Fixture[] stddatas = { new Fixture( @@ -88,6 +88,7 @@ } ), }; + */ /** * 各種カメラGPXファイル @@ -113,8 +114,8 @@ new Fixture( "[A2].SONYカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルもコピーする時", "target/test-classes/imgdata/Sony20170518.tar.gz", - "target/test-classes/gpx/20170518.gpx", "target/test-classes/cameradata/20170518.gpx", + "target/test-classes/output/20170518.gpx", "target/test-classes/ini/AdjustTime.20170518.A2.ini", new Expecter[] { new Expecter("10170518/DSC05183.JPG", true, "2017:05:18 09:16:48", 90.0D, 180.0D, null), @@ -129,7 +130,7 @@ "[B1].WiMiUSカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時", "target/test-classes/imgdata/WiMiUS20170518.tar.gz", "target/test-classes/gpx/20170518.gpx", - "target/test-classes/cameradata/20170518.gpx", + "target/test-classes/output/20170518.gpx", "target/test-classes/ini/AdjustTime.20170518.B1.ini", new Expecter[] { new Expecter("cameradata/20170518_092031A.jpg", false, null, 90.0D, 180.0D, null), @@ -562,5 +563,6 @@ } ), }; + //public static Fixture[] stddatas; } diff --git a/src/test/java/osm/jp/gpx/ImportPictureTest.java b/src/test/java/osm/jp/gpx/ImportPictureTest.java index 3d9b074..fbec0f1 100644 --- a/src/test/java/osm/jp/gpx/ImportPictureTest.java +++ b/src/test/java/osm/jp/gpx/ImportPictureTest.java @@ -20,12 +20,12 @@ @Theory public void パラメータテスト(Fixture dataset) throws Exception { - ImportPictureTest.setup(dataset); - ImportPictureTest.testdo(dataset.iniFilePath); + setup(dataset); + testdo(dataset.iniFilePath); Expecter.check(dataset); } - static void setup(Fixture dataset) throws IOException { + void setup(Fixture dataset) throws IOException { System.out.println(dataset.toString()); // カメラディレクトリを削除する @@ -56,7 +56,7 @@ * 実行する * @throws Exception */ - static void testdo(String iniFilePath) { + void testdo(String iniFilePath) { try { String[] argv = {iniFilePath}; ImportPicture.main(argv); diff --git a/src/test/java/osm/jp/gpx/ImportPictureUnitTest.java b/src/test/java/osm/jp/gpx/ImportPictureUnitTest.java index d4cdd8c..7f5cfea 100644 --- a/src/test/java/osm/jp/gpx/ImportPictureUnitTest.java +++ b/src/test/java/osm/jp/gpx/ImportPictureUnitTest.java @@ -17,7 +17,7 @@ @Before public void setUp() throws Exception { - Fixture dataset = Fixture.stddatas[0]; + Fixture dataset = Fixture.datas[0]; System.out.println(dataset.toString()); // カメラディレクトリを削除する @@ -38,7 +38,7 @@ @Test public void 実行() throws Exception { - Fixture dataset = Fixture.stddatas[0]; + Fixture dataset = Fixture.datas[0]; try { ImportPictureUnitTest.testdo(dataset.iniFilePath); } @@ -56,7 +56,7 @@ @Test public void MAGVARをON() throws Exception { - Fixture dataset = Fixture.stddatas[1]; + Fixture dataset = Fixture.datas[1]; try { ImportPictureUnitTest.testdo(dataset.iniFilePath); } @@ -81,7 +81,7 @@ @Before public void setUp() throws Exception { - Fixture dataset = Fixture.stddatas[0]; + Fixture dataset = Fixture.datas[0]; System.out.println(dataset.toString()); // カメラディレクトリを削除する @@ -104,7 +104,7 @@ @Test public void 実行() throws Exception { - Fixture dataset = Fixture.stddatas[0]; + Fixture dataset = Fixture.datas[0]; try { ImportPictureUnitTest.testdo(dataset.iniFilePath); fail("outDirがFILEなのに、例外が発生しなかった"); // 例外が発生しなかった diff --git a/src/test/resources/ini/AdjustTime.20170518.A2.ini b/src/test/resources/ini/AdjustTime.20170518.A2.ini index eb3f3ad..41002e3 100644 --- a/src/test/resources/ini/AdjustTime.20170518.A2.ini +++ b/src/test/resources/ini/AdjustTime.20170518.A2.ini @@ -13,5 +13,5 @@ GPX.OVERWRITE_MAGVAR=false GPX.REUSE=false IMG.SOURCE_FOLDER=target/test-classes/cameradata/10170518 -GPX.SOURCE_FOLDER=target/test-classes/cameradata/20170518.gpx +GPX.SOURCE_FOLDER=target/test-classes/cameradata IMG.OUTPUT_FOLDER=target/test-classes/output diff --git a/src/test/resources/ini/AdjustTime.20170518.B1.ini b/src/test/resources/ini/AdjustTime.20170518.B1.ini index 8b2861d..cc63d9d 100644 --- a/src/test/resources/ini/AdjustTime.20170518.B1.ini +++ b/src/test/resources/ini/AdjustTime.20170518.B1.ini @@ -13,5 +13,5 @@ GPX.REUSE=false IMG.BASE_FILE=20170518_092031A.jpg IMG.SOURCE_FOLDER=target/test-classes/cameradata -GPX.SOURCE_FOLDER=target/test-classes/cameradata/20170518.gpx +GPX.SOURCE_FOLDER=target/test-classes/gpx/20170518.gpx IMG.OUTPUT_FOLDER=target/test-classes/output