mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 11:49:04 +01:00
Refactor integration tests to allow clock to be replaced.
This commit is contained in:
@@ -14,6 +14,7 @@ import dagger.Provides;
|
||||
DefaultEventExecutorModule.class,
|
||||
DefaultTaskSchedulerModule.class,
|
||||
DefaultWakefulIoExecutorModule.class,
|
||||
TestClockModule.class,
|
||||
TestDatabaseConfigModule.class,
|
||||
TestPluginConfigModule.class,
|
||||
TestSecureRandomModule.class
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user