예제 #1
0
  @Parameterized.Parameters(name = "{0}")
  public static Collection<Object[]> getTestParameters() throws IOException {
    Collection<Object[]> filenames = new ArrayList<>();

    try {
      H4EosFileFilter ff = new H4EosFileFilter();
      TestDir.actOnAllParameterized(TestH4eos.testDir, ff, filenames);
    } catch (IOException e) {
      // JUnit *always* executes a test class's @Parameters method, even if it won't subsequently
      // run the class's tests
      // due to an @Category exclusion. Therefore, we must not let it throw an exception, or else
      // we'll get a build
      // failure. Instead, we return a collection containing a nonsense value (to wit, the exception
      // message).
      //
      // Naturally, if we execute a test using that nonsense value, it'll fail. That's fine; we need
      // to deal with the
      // root cause. However, it is more likely that the exception occurred because
      // "!isCdmUnitTestDirAvailable", and
      // as a result, all NeedsCdmUnitTest tests will be excluded.
      filenames.add(new Object[] {e.getMessage()});
    }

    return filenames;
  }
예제 #2
0
 @Test
 public void testCompare() throws IOException {
   long start = System.currentTimeMillis();
   countOk += TestDir.actOnAll(TestDir.cdmUnitTestDir + "formats/mcidas", null, new MyAct());
   long took = (System.currentTimeMillis() - start);
   System.out.printf("countOk=%d, countFail=%d took %d msecs %n", countOk, countFail, took);
   assert countFail == 0;
 }