mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 17:26:22 +01:00
merge
This commit is contained in:
@@ -67,7 +67,7 @@ public class BranchRootResourceTest extends RepositoryTestBase {
|
||||
@InjectMocks
|
||||
private BranchToBranchDtoMapperImpl branchToDtoMapper;
|
||||
|
||||
private ChangesetCollectionToDtoMapper changesetCollectionToDtoMapper;
|
||||
private BranchChangesetCollectionToDtoMapper changesetCollectionToDtoMapper;
|
||||
|
||||
private BranchRootResource branchRootResource;
|
||||
|
||||
@@ -90,7 +90,7 @@ public class BranchRootResourceTest extends RepositoryTestBase {
|
||||
|
||||
@Before
|
||||
public void prepareEnvironment() throws Exception {
|
||||
changesetCollectionToDtoMapper = new ChangesetCollectionToDtoMapper(changesetToChangesetDtoMapper, resourceLinks);
|
||||
changesetCollectionToDtoMapper = new BranchChangesetCollectionToDtoMapper(changesetToChangesetDtoMapper, resourceLinks);
|
||||
BranchCollectionToDtoMapper branchCollectionToDtoMapper = new BranchCollectionToDtoMapper(branchToDtoMapper, resourceLinks);
|
||||
branchRootResource = new BranchRootResource(serviceFactory, branchToDtoMapper, branchCollectionToDtoMapper, changesetCollectionToDtoMapper);
|
||||
super.branchRootResource = Providers.of(branchRootResource);
|
||||
@@ -152,6 +152,10 @@ public class BranchRootResourceTest extends RepositoryTestBase {
|
||||
when(logCommandBuilder.setPagingLimit(anyInt())).thenReturn(logCommandBuilder);
|
||||
when(logCommandBuilder.setBranch(anyString())).thenReturn(logCommandBuilder);
|
||||
when(logCommandBuilder.getChangesets()).thenReturn(changesetPagingResult);
|
||||
Branches branches = mock(Branches.class);
|
||||
List<Branch> branchList = Lists.newArrayList(new Branch("master",id));
|
||||
when(branches.getBranches()).thenReturn(branchList);
|
||||
when(branchesCommandBuilder.getBranches()).thenReturn(branches);
|
||||
MockHttpRequest request = MockHttpRequest.get(BRANCH_URL + "/changesets/");
|
||||
MockHttpResponse response = new MockHttpResponse();
|
||||
dispatcher.invoke(request, response);
|
||||
@@ -161,6 +165,5 @@ public class BranchRootResourceTest extends RepositoryTestBase {
|
||||
assertTrue(response.getContentAsString().contains(String.format("\"name\":\"%s\"", authorName)));
|
||||
assertTrue(response.getContentAsString().contains(String.format("\"mail\":\"%s\"", authorEmail)));
|
||||
assertTrue(response.getContentAsString().contains(String.format("\"description\":\"%s\"", commit)));
|
||||
assertTrue(response.getContentAsString().contains(String.format("\"description\":\"%s\"", commit)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.github.sdorra.shiro.SubjectAware;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.apache.shiro.util.ThreadContext;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
@@ -94,6 +95,10 @@ import static org.mockito.Mockito.when;
|
||||
)
|
||||
public class DefaultRepositoryManagerTest extends ManagerTestBase<Repository> {
|
||||
|
||||
{
|
||||
ThreadContext.unbindSubject();
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ShiroRule shiro = new ShiroRule();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user