diff --git a/importPicture/test/osm/jp/gpx/ElementMapTRKSEGTest.java b/importPicture/test/osm/jp/gpx/ElementMapTRKSEGTest.java index 4446e9d..49a2dd8 100644 --- a/importPicture/test/osm/jp/gpx/ElementMapTRKSEGTest.java +++ b/importPicture/test/osm/jp/gpx/ElementMapTRKSEGTest.java @@ -12,55 +12,59 @@ import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; +import org.junit.experimental.runners.Enclosed; -@RunWith(Theories.class) +@RunWith(Enclosed.class) public class ElementMapTRKSEGTest { - - static class Fixture { - String gpxSourcePath; // GPXファイル(オリジナル) - int segCount; // GPXファイルに含まれるTRKSEGノードの数 - - public Fixture( - String gpxSourcePath, - int segCount - ) { - this.gpxSourcePath = gpxSourcePath; - this.segCount = segCount; - } - - public String toString() { - String msg = "テストパターン : \n"; - msg += "\tgpxSourcePath = "+ gpxSourcePath +"\n"; - msg += "\tsegCount = "+ segCount; - return msg; - } - } - - @DataPoints - public static Fixture[] datas = { - new Fixture("testdata/20170517.gpx", 1), - new Fixture("testdata/20170518.gpx", 1), - new Fixture("testdata/muiltiTRK.GarminColorado.gpx.xml", 3), - new Fixture("testdata/muiltiTRKSEG.GarminColorado.gpx.xml", 3), - new Fixture("testdata/muiltiTRKSEG.noNameSpace.gpx.xml", 3), - new Fixture("testdata/multiTRKSEG.eTrex_20J.gpx.xml", 3), - new Fixture("testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml", 3), - }; - - @Theory - public void TRKSEGを読み込む(Fixture dataset) { - try { - ElementMapTRKSEG mapTRKSEG = new ElementMapTRKSEG(); - mapTRKSEG.parse(new File(dataset.gpxSourcePath)); - mapTRKSEG.printinfo(); - System.out.println("GPX file: "+ dataset.gpxSourcePath); - assertThat(mapTRKSEG.size(), is(dataset.segCount)); - for (Date key : mapTRKSEG.keySet()) { - assertThat(key, is(notNullValue())); + @RunWith(Theories.class) + public static class 各種GPXファイルを食わせる { + static class Fixture { + String gpxSourcePath; // GPXファイル(オリジナル) + int segCount; // GPXファイルに含まれるTRKSEGノードの数 + + public Fixture( + String gpxSourcePath, + int segCount + ) { + this.gpxSourcePath = gpxSourcePath; + this.segCount = segCount; + } + + public String toString() { + String msg = "テストパターン : \n"; + msg += "\tgpxSourcePath = "+ gpxSourcePath +"\n"; + msg += "\tsegCount = "+ segCount; + return msg; } } - catch (Exception e) { - fail(); + + @DataPoints + public static Fixture[] datas = { + new Fixture("testdata/20170517.gpx", 1), + new Fixture("testdata/20170518.gpx", 1), + new Fixture("testdata/muiltiTRK.GarminColorado.gpx.xml", 3), + new Fixture("testdata/muiltiTRKSEG.GarminColorado.gpx.xml", 3), + new Fixture("testdata/muiltiTRKSEG.noNameSpace.gpx.xml", 3), + new Fixture("testdata/multiTRKSEG.eTrex_20J.gpx.xml", 3), + new Fixture("testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml", 3), + }; + + @Theory + public void TRKSEGを読み込む(Fixture dataset) { + try { + ElementMapTRKSEG mapTRKSEG = new ElementMapTRKSEG(); + mapTRKSEG.parse(new File(dataset.gpxSourcePath)); + mapTRKSEG.printinfo(); + System.out.println("GPX file: "+ dataset.gpxSourcePath); + assertThat(mapTRKSEG.size(), is(dataset.segCount)); + for (Date key : mapTRKSEG.keySet()) { + assertThat(key, is(notNullValue())); + } + } + catch (Exception e) { + fail(); + } } + } }