3 import static org.hamcrest.CoreMatchers.is;
4 import static org.hamcrest.CoreMatchers.notNullValue;
5 import static org.junit.Assert.assertThat;
6 import static org.junit.Assert.fail;
11 import org.junit.experimental.theories.DataPoints;
12 import org.junit.experimental.theories.Theories;
13 import org.junit.experimental.theories.Theory;
14 import org.junit.runner.RunWith;
16 @RunWith(Theories.class)
17 public class ElementMapTRKSEGTest {
19 static class Fixture {
20 String gpxSourcePath; // GPXファイル(オリジナル)
21 int segCount; // GPXファイルに含まれるTRKSEGノードの数
27 this.gpxSourcePath = gpxSourcePath;
28 this.segCount = segCount;
31 public String toString() {
32 String msg = "テストパターン : \n";
33 msg += "\tgpxSourcePath = "+ gpxSourcePath +"\n";
34 msg += "\tsegCount = "+ segCount;
40 public static Fixture[] datas = {
41 new Fixture("testdata/20170517.gpx", 1),
42 new Fixture("testdata/20170518.gpx", 1),
43 new Fixture("testdata/muiltiTRK.GarminColorado.gpx.xml", 3),
44 new Fixture("testdata/muiltiTRKSEG.GarminColorado.gpx.xml", 3),
45 new Fixture("testdata/muiltiTRKSEG.noNameSpace.gpx.xml", 3),
46 new Fixture("testdata/multiTRKSEG.eTrex_20J.gpx.xml", 3),
47 new Fixture("testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml", 3),
51 public void TRKSEGを読み込む(Fixture dataset) {
53 ElementMapTRKSEG mapTRKSEG = new ElementMapTRKSEG();
54 mapTRKSEG.parse(new File(dataset.gpxSourcePath));
55 mapTRKSEG.printinfo();
56 System.out.println("GPX file: "+ dataset.gpxSourcePath);
57 assertThat(mapTRKSEG.size(), is(dataset.segCount));
58 for (Date key : mapTRKSEG.keySet()) {
59 assertThat(key, is(notNullValue()));