// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/data/EvaluationContext.java
// static final String JUNITPERF_DURATION_MS = "junitperf.durationMs";
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/data/EvaluationContext.java
// static final String JUNITPERF_MAX_EXECUTIONS_PER_SECOND = "junitperf.maxExecutionsPerSecond";
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/data/EvaluationContext.java
// static final String JUNITPERF_RAMP_UP_PERIOD_MS = "junitperf.rampUpPeriodMs";
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/data/EvaluationContext.java
// static final String JUNITPERF_THREADS = "junitperf.threads";
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/data/EvaluationContext.java
// static final String JUNITPERF_WARM_UP_MS = "junitperf.warmUpMs";
// 
// Path: junitperf-core/src/test/java/com/github/noconnor/junitperf/BaseTest.java
// @Ignore
// public class BaseTest {
// 
//   public BaseTest() {
//     MockitoAnnotations.initMocks(this);
//   }
// 
// }
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/datetime/DatetimeUtils.java
// @UtilityClass
// public class DatetimeUtils {
// 
//   @Setter
//   private static String override;
// 
//   public static String now() {
//     if (nonNull(override)) {
//       return override;
//     }
//     return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
//   }
// 
//   public static String format(int durationMs) {
//     long seconds = durationMs / 1000;
//     long minutes = seconds / 60;
//     long hours = minutes / 60;
//     long days = hours / 24;
//     if (days > 0){
//       return days + "d:" + hours % 24 + "h:" + minutes % 60 + "m:" + seconds % 60 + "s";
//     } else if (hours > 0){
//       return hours % 24 + "h:" + minutes % 60 + "m:" + seconds % 60 + "s";
//     } else if (minutes > 0){
//       return minutes % 60 + "m:" + seconds % 60 + "s";
//     } if (seconds > 0){
//       return (seconds % 60) + "s";
//     } else {
//       return durationMs + "ms";
//     }
//   }
// }
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/statistics/StatisticsCalculator.java
// public interface StatisticsCalculator {
// 
//   void addLatencyMeasurement(long executionTimeNs);
// 
//   void incrementErrorCount();
// 
//   void incrementEvaluationCount();
// 
//   long getErrorCount();
// 
//   long getEvaluationCount();
// 
//   float getLatencyPercentile(int percentile, TimeUnit unit);
// 
//   float getMaxLatency(TimeUnit unit);
// 
//   float getMinLatency(TimeUnit unit);
// 
//   float getMeanLatency(TimeUnit unit);
// 
//   float getErrorPercentage();
// 
//   void reset();
// 
// }


import static com.github.noconnor.junitperf.data.EvaluationContext.JUNITPERF_DURATION_MS;
import static com.github.noconnor.junitperf.data.EvaluationContext.JUNITPERF_MAX_EXECUTIONS_PER_SECOND;
import static com.github.noconnor.junitperf.data.EvaluationContext.JUNITPERF_RAMP_UP_PERIOD_MS;
import static com.github.noconnor.junitperf.data.EvaluationContext.JUNITPERF_THREADS;
import static com.github.noconnor.junitperf.data.EvaluationContext.JUNITPERF_WARM_UP_MS;
import static java.lang.System.nanoTime;
import static java.util.Collections.emptyMap;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.when;
import com.github.noconnor.junitperf.BaseTest;
import com.github.noconnor.junitperf.JUnitPerfTest;
import com.github.noconnor.junitperf.JUnitPerfTestRequirement;
import com.github.noconnor.junitperf.datetime.DatetimeUtils;
import com.github.noconnor.junitperf.statistics.StatisticsCalculator;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
package com.github.noconnor.junitperf.data;



public class EvaluationContextTest extends BaseTest {

  private static final String TEST_NAME = "UNITTEST";
  private static final String DATE_OVERRIDE = "2019-03-01 14:27:45";

  private EvaluationContext context;

  @Mock
  private StatisticsCalculator statisticsMock;

  @Mock
  private JUnitPerfTest perfTestAnnotation;

  @Mock
  private JUnitPerfTestRequirement perfTestRequirement;

  @Before
  public void setup() {
    initialisePerfTestAnnotation();
    initialisePerfTestRequirementAnnotation();
    initialiseStatisticsMockToPassValidation();
    DatetimeUtils.setOverride(DATE_OVERRIDE);
    context = new EvaluationContext(TEST_NAME, nanoTime());
  }

  @After
  public void tearDown(){
    System.clearProperty(JUNITPERF_THREADS);
    System.clearProperty(JUNITPERF_DURATION_MS);
    System.clearProperty(JUNITPERF_WARM_UP_MS);
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/data/EvaluationContext.java
// static final String JUNITPERF_DURATION_MS = "junitperf.durationMs";
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/data/EvaluationContext.java
// static final String JUNITPERF_MAX_EXECUTIONS_PER_SECOND = "junitperf.maxExecutionsPerSecond";
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/data/EvaluationContext.java
// static final String JUNITPERF_RAMP_UP_PERIOD_MS = "junitperf.rampUpPeriodMs";
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/data/EvaluationContext.java
// static final String JUNITPERF_THREADS = "junitperf.threads";
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/data/EvaluationContext.java
// static final String JUNITPERF_WARM_UP_MS = "junitperf.warmUpMs";
// 
// Path: junitperf-core/src/test/java/com/github/noconnor/junitperf/BaseTest.java
// @Ignore
// public class BaseTest {
// 
//   public BaseTest() {
//     MockitoAnnotations.initMocks(this);
//   }
// 
// }
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/datetime/DatetimeUtils.java
// @UtilityClass
// public class DatetimeUtils {
// 
//   @Setter
//   private static String override;
// 
//   public static String now() {
//     if (nonNull(override)) {
//       return override;
//     }
//     return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
//   }
// 
//   public static String format(int durationMs) {
//     long seconds = durationMs / 1000;
//     long minutes = seconds / 60;
//     long hours = minutes / 60;
//     long days = hours / 24;
//     if (days > 0){
//       return days + "d:" + hours % 24 + "h:" + minutes % 60 + "m:" + seconds % 60 + "s";
//     } else if (hours > 0){
//       return hours % 24 + "h:" + minutes % 60 + "m:" + seconds % 60 + "s";
//     } else if (minutes > 0){
//       return minutes % 60 + "m:" + seconds % 60 + "s";
//     } if (seconds > 0){
//       return (seconds % 60) + "s";
//     } else {
//       return durationMs + "ms";
//     }
//   }
// }
// 
// Path: junitperf-core/src/main/java/com/github/noconnor/junitperf/statistics/StatisticsCalculator.java
// public interface StatisticsCalculator {
// 
//   void addLatencyMeasurement(long executionTimeNs);
// 
//   void incrementErrorCount();
// 
//   void incrementEvaluationCount();
// 
//   long getErrorCount();
// 
//   long getEvaluationCount();
// 
//   float getLatencyPercentile(int percentile, TimeUnit unit);
// 
//   float getMaxLatency(TimeUnit unit);
// 
//   float getMinLatency(TimeUnit unit);
// 
//   float getMeanLatency(TimeUnit unit);
// 
//   float getErrorPercentage();
// 
//   void reset();
// 
// }


// Path: junitperf-core/src/test/java/com/github/noconnor/junitperf/data/EvaluationContextTest.java
import static com.github.noconnor.junitperf.data.EvaluationContext.JUNITPERF_DURATION_MS;
import static com.github.noconnor.junitperf.data.EvaluationContext.JUNITPERF_MAX_EXECUTIONS_PER_SECOND;
import static com.github.noconnor.junitperf.data.EvaluationContext.JUNITPERF_RAMP_UP_PERIOD_MS;
import static com.github.noconnor.junitperf.data.EvaluationContext.JUNITPERF_THREADS;
import static com.github.noconnor.junitperf.data.EvaluationContext.JUNITPERF_WARM_UP_MS;
import static java.lang.System.nanoTime;
import static java.util.Collections.emptyMap;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.when;
import com.github.noconnor.junitperf.BaseTest;
import com.github.noconnor.junitperf.JUnitPerfTest;
import com.github.noconnor.junitperf.JUnitPerfTestRequirement;
import com.github.noconnor.junitperf.datetime.DatetimeUtils;
import com.github.noconnor.junitperf.statistics.StatisticsCalculator;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;

package com.github.noconnor.junitperf.data;



public class EvaluationContextTest extends BaseTest {

  private static final String TEST_NAME = "UNITTEST";
  private static final String DATE_OVERRIDE = "2019-03-01 14:27:45";

  private EvaluationContext context;

  @Mock
  private StatisticsCalculator statisticsMock;

  @Mock
  private JUnitPerfTest perfTestAnnotation;

  @Mock
  private JUnitPerfTestRequirement perfTestRequirement;

  @Before
  public void setup() {
    initialisePerfTestAnnotation();
    initialisePerfTestRequirementAnnotation();
    initialiseStatisticsMockToPassValidation();
    DatetimeUtils.setOverride(DATE_OVERRIDE);
    context = new EvaluationContext(TEST_NAME, nanoTime());
  }

  @After
  public void tearDown(){
    System.clearProperty(JUNITPERF_THREADS);
    System.clearProperty(JUNITPERF_DURATION_MS);
    System.clearProperty(JUNITPERF_WARM_UP_MS);
    System.clearProperty(JUNITPERF_MAX_EXECUTIONS_PER_SECOND);