Newer
Older
restamp / src / test / java / osm / surveyor / matchtime / RestampTest.java
  1. package osm.surveyor.matchtime;
  2.  
  3. import static org.junit.Assert.*;
  4.  
  5. import java.io.*;
  6. import org.junit.experimental.theories.DataPoints;
  7. import org.junit.experimental.theories.Theories;
  8. import org.junit.experimental.theories.Theory;
  9. import org.junit.runner.RunWith;
  10.  
  11. @RunWith(Theories.class)
  12. public class RestampTest {
  13. String dirPath;
  14. String outPath;
  15.  
  16. @DataPoints
  17. public static Fixture[] datas = Fixture.datas;
  18.  
  19. @Theory
  20. public void パラメータテスト(Fixture dataset) {
  21. try {
  22. System.out.println(dataset.toString());
  23. RestampTest.setUp();
  24. dataset.setUp();
  25. Restamp.main(dataset.args);
  26. dataset.check();
  27. dataset.checkUnchanged();
  28. RestampTest.tearDown();
  29. }
  30. catch(Exception e) {
  31. e.printStackTrace();
  32. fail("Exceptionが発生した。");
  33. }
  34. }
  35. static void setUp() throws IOException {
  36. tearDown();
  37. // カメラディレクトリを作成する
  38. UnZip.uncompress(new File("./target/test-classes/data/images.tar.gz"), new File("./target/test-classes/"));
  39.  
  40. // OUTディレクトリを作成する
  41. File outDir = new File("target/test-classes/out");
  42. outDir.mkdir();
  43. }
  44. static void tearDown() throws IOException {
  45. // IMGディレクトリを削除する
  46. File dir = new File("target/test-classes/images");
  47. if (dir.exists()) {
  48. UnZip.delete(dir);
  49. }
  50. // OUTディレクトリを削除する
  51. File outDir = new File("target/test-classes/out");
  52. if (outDir.exists()) {
  53. UnZip.delete(outDir);
  54. }
  55. }
  56. }