package me.atam.atam4j;

import io.dropwizard.setup.Environment;
import me.atam.atam4j.health.AcceptanceTestsHealthCheck;
import me.atam.atam4j.health.AcceptanceTestsState;

import java.util.concurrent.TimeUnit;

public class Atam4j {

    private AcceptanceTestsRunnerTaskScheduler acceptanceTestsRunnerTaskScheduler;
    private AcceptanceTestsState acceptanceTestsState = new AcceptanceTestsState();
    private Environment environment;

    public Atam4j(AcceptanceTestsRunnerTaskScheduler acceptanceTestsRunnerTaskScheduler,
                  Environment environment) {
        this.acceptanceTestsRunnerTaskScheduler = acceptanceTestsRunnerTaskScheduler;
        this.environment = environment;
    }

    public void initialise() {
        acceptanceTestsRunnerTaskScheduler.scheduleAcceptanceTestsRunnerTask();
        AcceptanceTestsHealthCheck healthCheck = new AcceptanceTestsHealthCheck(acceptanceTestsState);
        environment.healthChecks().register(AcceptanceTestsHealthCheck.NAME, healthCheck);
    }

    public static class Atam4jBuilder {

        private AcceptanceTestsState acceptanceTestsState = new AcceptanceTestsState();
        private Environment environment = null;
        private Class testClasses[] = null;
        private long initialDelay = 60;
        private long period = 300;
        private TimeUnit unit = TimeUnit.SECONDS;

        public Atam4jBuilder withAcceptanceTestsState(AcceptanceTestsState acceptanceTestsState) {
            this.acceptanceTestsState = acceptanceTestsState;
            return this;
        }

        public Atam4jBuilder withEnvironment(Environment environment) {
            this.environment = environment;
            return this;
        }

        public Atam4jBuilder withTestClasses(Class[] testClasses) {
            this.testClasses = testClasses;
            return this;
        }

        public Atam4jBuilder withInitialDelay(long initialDelay) {
            this.initialDelay = initialDelay;
            return this;
        }

        public Atam4jBuilder withPeriod(long period) {
            this.period = period;
            return this;
        }

        public Atam4jBuilder withUnit(TimeUnit unit) {
            this.unit = unit;
            return this;
        }

        public Atam4j build() {

            if (environment == null) {
                throw new IllegalStateException("No Environment specified");
            }

            if (testClasses == null) {
                throw new IllegalStateException("No test classes specified");
            }

            return new Atam4j(
                    new AcceptanceTestsRunnerTaskScheduler(
                        environment,
                        testClasses,
                        acceptanceTestsState,
                        initialDelay,
                        period,
                        unit),
                    this.environment);
        }
    }
}
@@ -245,90 +245,14 @@
 ate 
-AcceptanceTestsRunnerTaskScheduler acceptanceTestsRunnerTaskScheduler;%0A    private
+static
  Acc
@@ -324,32 +324,39 @@
 ();%0A    private 
+static 
 Environment envi
@@ -365,16 +365,100 @@
 nment;%0A%0A
+    private AcceptanceTestsRunnerTaskScheduler acceptanceTestsRunnerTaskScheduler;%0A%0A
     publ
@@ -1073,96 +1073,8 @@
  %7B%0A%0A
-        private AcceptanceTestsState acceptanceTestsState = new AcceptanceTestsState();%0A
     
@@ -1236,16 +1236,16 @@
  = 300;%0A
+
         
@@ -1291,205 +1291,8 @@
 S;%0A%0A
-        public Atam4jBuilder withAcceptanceTestsState(AcceptanceTestsState acceptanceTestsState) %7B%0A            this.acceptanceTestsState = acceptanceTestsState;%0A            return this;%0A        %7D%0A%0A
     

Use static instance variables and remove AcceptanceTestsState form builder