コード例 #1
0
 private Collection<Context> createContexts(MachineConfiguration machineConfiguration) {
   Set<Context> contexts = new HashSet<>();
   for (ContextConfiguration contextConfiguration :
       machineConfiguration.getContextConfigurations()) {
     Context context = createContext(contextConfiguration.getTestClass());
     configureContext(context);
     contexts.add(context);
   }
   return contexts;
 }
コード例 #2
0
 private void configureContext(Context context) {
   Set<Model> models = AnnotationUtils.getAnnotations(context.getClass(), Model.class);
   GraphWalker annotation = context.getClass().getAnnotation(GraphWalker.class);
   if (!models.isEmpty()) {
     Path path = Paths.get(models.iterator().next().file());
     ContextFactoryScanner.get(reflections, path).create(path, context);
   }
   if (!"".equals(annotation.value())) {
     context.setPathGenerator(GeneratorFactory.parse(annotation.value()));
   } else {
     context.setPathGenerator(PathGeneratorFactory.createPathGenerator(annotation));
   }
   if (!"".equals(annotation.start())) {
     context.setNextElement(getElement(context.getModel(), annotation.start()));
   }
 }