package it.cavallium.strangedb.tests.performance; import it.cavallium.strangedb.functionalinterfaces.RunnableWithIO; import java.io.IOException; public interface PerformanceTest { void setup() throws IOException; void perTestSetup() throws IOException; void test() throws IOException; void perTestEnd() throws IOException; void end() throws IOException; static PerformanceTest createTest(RunnableWithIO setupRunnable, RunnableWithIO perTestSetupRunnable, RunnableWithIO testRunnable, RunnableWithIO perTestEndRunnable, RunnableWithIO endRunnable) { return new PerformanceTest() { @Override public void setup() throws IOException { setupRunnable.run(); } @Override public void perTestSetup() throws IOException { perTestSetupRunnable.run(); } @Override public void test() throws IOException { testRunnable.run(); } @Override public void perTestEnd() throws IOException { perTestEndRunnable.run(); } @Override public void end() throws IOException { endRunnable.run(); } }; } static PerformanceTest createTest(RunnableWithIO perTestSetupRunnable, RunnableWithIO testRunnable, RunnableWithIO perTestEndRunnable) { return new PerformanceTest() { @Override public void setup() { } @Override public void perTestSetup() throws IOException { perTestSetupRunnable.run(); } @Override public void test() throws IOException { testRunnable.run(); } @Override public void perTestEnd() throws IOException { perTestEndRunnable.run(); } @Override public void end() { } }; } }