Fix gc job leak in tests

This commit is contained in:
Michael Walker 2018-03-09 11:01:04 +00:00
parent b5e7327410
commit b91390c025

View file

@ -1,5 +1,7 @@
package uk.ac.ic.wlgitbridge.bridge.gc; package uk.ac.ic.wlgitbridge.bridge.gc;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.stubbing.OngoingStubbing; import org.mockito.stubbing.OngoingStubbing;
import uk.ac.ic.wlgitbridge.bridge.lock.LockGuard; import uk.ac.ic.wlgitbridge.bridge.lock.LockGuard;
@ -24,9 +26,20 @@ public class GcJobImplTest {
RepoStore repoStore = mock(RepoStore.class); RepoStore repoStore = mock(RepoStore.class);
ProjectLock locks = new ProjectLockImpl(); ProjectLock locks;
GcJobImpl gcJob = new GcJobImpl(repoStore, locks, 5); GcJobImpl gcJob;
@Before
public void setup() {
locks = new ProjectLockImpl();
gcJob = new GcJobImpl(repoStore, locks, 5);
}
@After
public void teardown() {
gcJob.stop();
}
@Test @Test
public void addedProjectsAreAllEventuallyGcedOnce() throws Exception { public void addedProjectsAreAllEventuallyGcedOnce() throws Exception {