// Path: junitperf-junit4/src/main/java/com/github/noconnor/junitperf/JUnitPerfRule.java
// @SuppressWarnings("WeakerAccess")
// public class JUnitPerfRule implements TestRule {
// 
//   static final Map<Class<?>, LinkedHashSet<EvaluationContext>> ACTIVE_CONTEXTS = new HashMap<>();
// 
//   private final Set<ReportGenerator> reporters;
// 
//   StatisticsCalculator statisticsCalculator;
//   PerformanceEvaluationStatementBuilder perEvalBuilder;
//   boolean excludeBeforeAndAfters;
// 
//   public JUnitPerfRule() {
//     this(false);
//   }
// 
//   public JUnitPerfRule(boolean excludeBeforeAndAfters) {
//     this(excludeBeforeAndAfters, new DescriptiveStatisticsCalculator(), new HtmlReportGenerator());
//   }
// 
//   public JUnitPerfRule(ReportGenerator... reportGenerator) {
//     this(false, reportGenerator);
//   }
// 
//   public JUnitPerfRule(boolean excludeBeforeAndAfters, ReportGenerator... reportGenerator) {
//     this(excludeBeforeAndAfters, new DescriptiveStatisticsCalculator(), reportGenerator);
//   }
// 
//   public JUnitPerfRule(StatisticsCalculator statisticsCalculator) {
//     this(false, statisticsCalculator);
//   }
// 
//   public JUnitPerfRule(boolean excludeBeforeAndAfters, StatisticsCalculator statisticsCalculator) {
//     this(excludeBeforeAndAfters, statisticsCalculator, new HtmlReportGenerator());
//   }
// 
//   public JUnitPerfRule(StatisticsCalculator statisticsCalculator, ReportGenerator... reportGenerator) {
//     this(false, statisticsCalculator, reportGenerator);
//   }
// 
//   public JUnitPerfRule(boolean excludeBeforeAndAfters, StatisticsCalculator statisticsCalculator, ReportGenerator... reportGenerator) {
//     this.perEvalBuilder = PerformanceEvaluationStatement.builder();
//     this.statisticsCalculator = statisticsCalculator;
//     this.reporters = Arrays.stream(reportGenerator).collect(toSet());
//     this.excludeBeforeAndAfters = excludeBeforeAndAfters;
//   }
// 
//   @Override
//   public Statement apply(Statement base, Description description) {
//     Statement activeStatement = base;
// 
//     JUnitPerfTest perfTestAnnotation = description.getAnnotation(JUnitPerfTest.class);
//     JUnitPerfTestRequirement requirementsAnnotation = description.getAnnotation(JUnitPerfTestRequirement.class);
// 
//     if (nonNull(perfTestAnnotation)) {
//       EvaluationContext context = createEvaluationContext(description);
//       context.loadConfiguration(perfTestAnnotation);
//       context.loadRequirements(requirementsAnnotation);
// 
//       // Group test contexts by test class
//       ACTIVE_CONTEXTS.putIfAbsent(description.getTestClass(), new LinkedHashSet<>());
//       ACTIVE_CONTEXTS.get(description.getTestClass()).add(context);
// 
//       TestStatement testStatement = excludeBeforeAndAfters ? new MeasurableStatement(base) : new DefaultStatement(base);
// 
//       PerformanceEvaluationStatement parallelExecution = perEvalBuilder.baseStatement(testStatement)
//         .statistics(statisticsCalculator)
//         .context(context)
//         .listener(complete -> updateReport(description.getTestClass()))
//         .build();
// 
//       activeStatement = new Statement() {
//         @Override
//         public void evaluate() throws Throwable {
//           parallelExecution.runParallelEvaluation();
//         }
//       };
//     }
//     return activeStatement;
//   }
// 
//   EvaluationContext createEvaluationContext(Description description) {
//     return new EvaluationContext(description.getMethodName(), nanoTime());
//   }
// 
//   private synchronized void updateReport(Class<?> testClass) {
//     reporters.forEach(r -> {
//       r.generateReport(ACTIVE_CONTEXTS.get(testClass));
//     });
//   }
// 
// }
// 
// Path: junit4-examples/src/test/java/com/github/noconnor/junitperf/examples/utils/ReportingUtils.java
// public static HtmlReportGenerator newHtmlReporter(String fileName){
//   return new HtmlReportGenerator(getProperty("user.dir") + "/build/reports/" + fileName);
// }


import org.junit.Rule;
import org.junit.Test;
import com.github.noconnor.junitperf.JUnitPerfRule;
import com.github.noconnor.junitperf.JUnitPerfTest;
import com.github.noconnor.junitperf.JUnitPerfTestRequirement;
import static com.github.noconnor.junitperf.examples.utils.ReportingUtils.newHtmlReporter;
package com.github.noconnor.junitperf.examples;



public class ExampleFailureTests {

  @Rule
// Path: junitperf-junit4/src/main/java/com/github/noconnor/junitperf/JUnitPerfRule.java
// @SuppressWarnings("WeakerAccess")
// public class JUnitPerfRule implements TestRule {
// 
//   static final Map<Class<?>, LinkedHashSet<EvaluationContext>> ACTIVE_CONTEXTS = new HashMap<>();
// 
//   private final Set<ReportGenerator> reporters;
// 
//   StatisticsCalculator statisticsCalculator;
//   PerformanceEvaluationStatementBuilder perEvalBuilder;
//   boolean excludeBeforeAndAfters;
// 
//   public JUnitPerfRule() {
//     this(false);
//   }
// 
//   public JUnitPerfRule(boolean excludeBeforeAndAfters) {
//     this(excludeBeforeAndAfters, new DescriptiveStatisticsCalculator(), new HtmlReportGenerator());
//   }
// 
//   public JUnitPerfRule(ReportGenerator... reportGenerator) {
//     this(false, reportGenerator);
//   }
// 
//   public JUnitPerfRule(boolean excludeBeforeAndAfters, ReportGenerator... reportGenerator) {
//     this(excludeBeforeAndAfters, new DescriptiveStatisticsCalculator(), reportGenerator);
//   }
// 
//   public JUnitPerfRule(StatisticsCalculator statisticsCalculator) {
//     this(false, statisticsCalculator);
//   }
// 
//   public JUnitPerfRule(boolean excludeBeforeAndAfters, StatisticsCalculator statisticsCalculator) {
//     this(excludeBeforeAndAfters, statisticsCalculator, new HtmlReportGenerator());
//   }
// 
//   public JUnitPerfRule(StatisticsCalculator statisticsCalculator, ReportGenerator... reportGenerator) {
//     this(false, statisticsCalculator, reportGenerator);
//   }
// 
//   public JUnitPerfRule(boolean excludeBeforeAndAfters, StatisticsCalculator statisticsCalculator, ReportGenerator... reportGenerator) {
//     this.perEvalBuilder = PerformanceEvaluationStatement.builder();
//     this.statisticsCalculator = statisticsCalculator;
//     this.reporters = Arrays.stream(reportGenerator).collect(toSet());
//     this.excludeBeforeAndAfters = excludeBeforeAndAfters;
//   }
// 
//   @Override
//   public Statement apply(Statement base, Description description) {
//     Statement activeStatement = base;
// 
//     JUnitPerfTest perfTestAnnotation = description.getAnnotation(JUnitPerfTest.class);
//     JUnitPerfTestRequirement requirementsAnnotation = description.getAnnotation(JUnitPerfTestRequirement.class);
// 
//     if (nonNull(perfTestAnnotation)) {
//       EvaluationContext context = createEvaluationContext(description);
//       context.loadConfiguration(perfTestAnnotation);
//       context.loadRequirements(requirementsAnnotation);
// 
//       // Group test contexts by test class
//       ACTIVE_CONTEXTS.putIfAbsent(description.getTestClass(), new LinkedHashSet<>());
//       ACTIVE_CONTEXTS.get(description.getTestClass()).add(context);
// 
//       TestStatement testStatement = excludeBeforeAndAfters ? new MeasurableStatement(base) : new DefaultStatement(base);
// 
//       PerformanceEvaluationStatement parallelExecution = perEvalBuilder.baseStatement(testStatement)
//         .statistics(statisticsCalculator)
//         .context(context)
//         .listener(complete -> updateReport(description.getTestClass()))
//         .build();
// 
//       activeStatement = new Statement() {
//         @Override
//         public void evaluate() throws Throwable {
//           parallelExecution.runParallelEvaluation();
//         }
//       };
//     }
//     return activeStatement;
//   }
// 
//   EvaluationContext createEvaluationContext(Description description) {
//     return new EvaluationContext(description.getMethodName(), nanoTime());
//   }
// 
//   private synchronized void updateReport(Class<?> testClass) {
//     reporters.forEach(r -> {
//       r.generateReport(ACTIVE_CONTEXTS.get(testClass));
//     });
//   }
// 
// }
// 
// Path: junit4-examples/src/test/java/com/github/noconnor/junitperf/examples/utils/ReportingUtils.java
// public static HtmlReportGenerator newHtmlReporter(String fileName){
//   return new HtmlReportGenerator(getProperty("user.dir") + "/build/reports/" + fileName);
// }


// Path: junit4-examples/src/test/java/com/github/noconnor/junitperf/examples/ExampleFailureTests.java
import org.junit.Rule;
import org.junit.Test;
import com.github.noconnor.junitperf.JUnitPerfRule;
import com.github.noconnor.junitperf.JUnitPerfTest;
import com.github.noconnor.junitperf.JUnitPerfTestRequirement;
import static com.github.noconnor.junitperf.examples.utils.ReportingUtils.newHtmlReporter;

package com.github.noconnor.junitperf.examples;



public class ExampleFailureTests {

  @Rule
  public JUnitPerfRule perfRule = new JUnitPerfRule(newHtmlReporter("failures.html"));