Refactor integration tests to allow clock to be replaced.

This commit is contained in:
akwizgran
2021-01-19 12:44:07 +00:00
committed by Torsten Grote
parent e10b6334f5
commit 5e2187a877
18 changed files with 141 additions and 100 deletions

View File

@@ -14,6 +14,7 @@ import dagger.Provides;
DefaultEventExecutorModule.class,
DefaultTaskSchedulerModule.class,
DefaultWakefulIoExecutorModule.class,
TestClockModule.class,
TestDatabaseConfigModule.class,
TestPluginConfigModule.class,
TestSecureRandomModule.class

View File

@@ -0,0 +1,28 @@
package org.briarproject.bramble.test;
import org.briarproject.bramble.api.system.Clock;
import org.briarproject.bramble.system.SystemClock;
import java.util.concurrent.atomic.AtomicLong;
import dagger.Module;
import dagger.Provides;
@Module
public class TestClockModule {
private final Clock clock;
public TestClockModule() {
clock = new SystemClock();
}
public TestClockModule(AtomicLong time) {
clock = new SettableClock(time);
}
@Provides
Clock provideClock() {
return clock;
}
}