Example #1
0
  @Override
  protected void runChild(Interaction interaction, RunNotifier notifier) {
    final Description description = describeChild(interaction);
    notifier.fireTestStarted(description);

    if (interaction.providerState().isDefined()) {
      final Optional<FrameworkMethod> initializationMethod =
          findProvderStateInitializationMethod(interaction.providerState().get());
      if (initializationMethod.isPresent()) {
        try {
          invokeMethod(initializationMethod.get());
          testPact(interaction);
          notifier.fireTestFinished(description);
          return;
        } catch (Exception ex) {
          notifier.fireTestFailure(new Failure(description, ex));
          return;
        }
      } else {
        notifier.fireTestIgnored(description);
        return;
      }
    }
    notifier.fireTestIgnored(description);
  }