From b91390c025b58ec88961399750134c750985e499 Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Fri, 9 Mar 2018 11:01:04 +0000 Subject: [PATCH] Fix gc job leak in tests --- .../ic/wlgitbridge/bridge/gc/GcJobImplTest.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/bridge/gc/GcJobImplTest.java b/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/bridge/gc/GcJobImplTest.java index 8ca35b3b13..091e6b5692 100644 --- a/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/bridge/gc/GcJobImplTest.java +++ b/services/git-bridge/src/test/java/uk/ac/ic/wlgitbridge/bridge/gc/GcJobImplTest.java @@ -1,5 +1,7 @@ package uk.ac.ic.wlgitbridge.bridge.gc; +import org.junit.After; +import org.junit.Before; import org.junit.Test; import org.mockito.stubbing.OngoingStubbing; import uk.ac.ic.wlgitbridge.bridge.lock.LockGuard; @@ -24,9 +26,20 @@ public class GcJobImplTest { 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 public void addedProjectsAreAllEventuallyGcedOnce() throws Exception {