예제 #1
0
 private void setDataSetFromAnnotation(Description description) {
   Class<?> testClass = description.getTestClass();
   Fixture fixture = findFixtureAnnotation(description);
   if (fixture == null) return;
   Fixture.Type type = fixture.type();
   String[] resources = fixture.resources();
   if (resources == null || resources.length == 0) return;
   try {
     if (resources.length == 1) {
       setDataSet(loadDataSet(type, resources[0], testClass));
     } else {
       IDataSet[] dataSets = new IDataSet[resources.length];
       for (int i = 0; i < resources.length; i++) {
         dataSets[i] = loadDataSet(type, resources[i], testClass);
       }
       setDataSet(new CompositeDataSet(dataSets));
     }
   } catch (YAMLException e) {
     throw new YAMLException("Cant load fixture: " + Arrays.toString(resources), e);
   } catch (DataSetException | URISyntaxException e) {
     throw new AssertionError(e);
   }
 }