Unbind subjects after unit tests

This commit is contained in:
René Pfeuffer
2018-08-31 08:46:56 +02:00
parent c3bf2a6e9c
commit 2420c9141c
2 changed files with 12 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ import org.jboss.resteasy.core.Dispatcher;
import org.jboss.resteasy.mock.MockDispatcherFactory;
import org.jboss.resteasy.mock.MockHttpRequest;
import org.jboss.resteasy.mock.MockHttpResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -105,6 +106,11 @@ public class BranchRootResourceTest {
when(subject.isPermitted(any(String.class))).thenReturn(true);
}
@After
public void cleanupContext() {
ThreadContext.unbindSubject();
}
@Test
public void shouldHandleMissingBranch() throws Exception {
when(branchesCommandBuilder.getBranches()).thenReturn(new Branches());

View File

@@ -11,6 +11,7 @@ import org.jboss.resteasy.core.Dispatcher;
import org.jboss.resteasy.mock.MockDispatcherFactory;
import org.jboss.resteasy.mock.MockHttpRequest;
import org.jboss.resteasy.mock.MockHttpResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -103,6 +104,11 @@ public class ChangesetRootResourceTest {
when(subject.isPermitted(any(String.class))).thenReturn(true);
}
@After
public void cleanupContext() {
ThreadContext.unbindSubject();
}
@Test
public void shouldGetChangeSets() throws Exception {
String id = "revision_123";