Skip to content

Commit 6597b69

Browse files
committed
Refactor tests for new dependencies
1 parent dc0ad31 commit 6597b69

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/test/java/org/commonwl/view/researchobject/ROBundleServiceTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.apache.taverna.robundle.manifest.PathMetadata;
2727
import org.commonwl.view.cwl.CWLTool;
2828
import org.commonwl.view.git.GitDetails;
29+
import org.commonwl.view.git.GitSemaphore;
2930
import org.commonwl.view.git.GitService;
3031
import org.commonwl.view.graphviz.GraphVizService;
3132
import org.commonwl.view.workflow.Workflow;
@@ -45,8 +46,7 @@
4546
import java.util.Set;
4647

4748
import static org.junit.Assert.*;
48-
import static org.mockito.Matchers.anyObject;
49-
import static org.mockito.Matchers.anyString;
49+
import static org.mockito.Matchers.*;
5050
import static org.mockito.Mockito.when;
5151

5252
public class ROBundleServiceTest {
@@ -76,7 +76,7 @@ public void generateAndSaveROBundle() throws Exception {
7676

7777
// Get mock Git service
7878
GitService mockGitService = Mockito.mock(GitService.class);
79-
when(mockGitService.getRepository(anyObject())).thenReturn(gitRepo);
79+
when(mockGitService.getRepository(anyObject(), anyBoolean())).thenReturn(gitRepo);
8080

8181
Set<HashableAgent> authors = new HashSet<>();
8282
authors.add(new HashableAgent("Mark Robinson", null, new URI("mailto:[email protected]")));
@@ -110,7 +110,7 @@ public void generateAndSaveROBundle() throws Exception {
110110
// Create new RO bundle
111111
ROBundleService bundleService = new ROBundleService(roBundleFolder.getRoot().toPath(),
112112
"CWL Viewer", "https://view.commonwl.org", 5242880,
113-
mockGraphvizService, mockGitService, mockCwlTool);
113+
mockGraphvizService, mockGitService, Mockito.mock(GitSemaphore.class), mockCwlTool);
114114
Bundle bundle = bundleService.createBundle(lobSTRv1, lobSTRv1RODetails);
115115
Path bundleRoot = bundle.getRoot().resolve("workflow");
116116

@@ -173,7 +173,7 @@ public void filesOverLimit() throws Exception {
173173

174174
// Get mock Git service
175175
GitService mockGitService = Mockito.mock(GitService.class);
176-
when(mockGitService.getRepository(anyObject())).thenReturn(gitRepo);
176+
when(mockGitService.getRepository(anyObject(), anyBoolean())).thenReturn(gitRepo);
177177

178178
Set<HashableAgent> authors = new HashSet<>();
179179
authors.add(new HashableAgent("Mark Robinson", null, new URI("mailto:[email protected]")));
@@ -207,7 +207,7 @@ public void filesOverLimit() throws Exception {
207207
// Create new RO bundle
208208
ROBundleService bundleService = new ROBundleService(roBundleFolder.getRoot().toPath(),
209209
"CWL Viewer", "https://view.commonwl.org", 0, mockGraphvizService,
210-
mockGitService, mockCwlTool);
210+
mockGitService, Mockito.mock(GitSemaphore.class), mockCwlTool);
211211
Bundle bundle = bundleService.createBundle(lobSTRv1, lobSTRv1RODetails);
212212

213213
Manifest manifest = bundle.getManifest();

src/test/java/org/commonwl/view/workflow/WorkflowServiceTest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.commonwl.view.cwl.CWLService;
2323
import org.commonwl.view.cwl.CWLToolRunner;
2424
import org.commonwl.view.git.GitDetails;
25+
import org.commonwl.view.git.GitSemaphore;
2526
import org.commonwl.view.git.GitService;
2627
import org.commonwl.view.graphviz.GraphVizService;
2728
import org.commonwl.view.researchobject.ROBundleFactory;
@@ -37,6 +38,7 @@
3738
import java.util.HashMap;
3839

3940
import static org.junit.Assert.assertEquals;
41+
import static org.mockito.Matchers.anyBoolean;
4042
import static org.mockito.Matchers.anyObject;
4143
import static org.mockito.Mockito.when;
4244

@@ -82,7 +84,7 @@ public void getWorkflowCacheHasExpired() throws Exception {
8284
when(mockGitRepo.getRepository()).thenReturn(mockRepo);
8385

8486
GitService mockGitService = Mockito.mock(GitService.class);
85-
when(mockGitService.getRepository(anyObject())).thenReturn(mockGitRepo);
87+
when(mockGitService.getRepository(anyObject(), anyBoolean())).thenReturn(mockGitRepo);
8688
when(mockGitService.getCurrentCommitID(anyObject())).thenReturn("newCommitId");
8789

8890
// Create service under test with negative cache time (always create new workflow)
@@ -91,7 +93,8 @@ public void getWorkflowCacheHasExpired() throws Exception {
9193
mockWorkflowRepo, Mockito.mock(QueuedWorkflowRepository.class),
9294
Mockito.mock(ROBundleFactory.class),
9395
Mockito.mock(GraphVizService.class),
94-
Mockito.mock(CWLToolRunner.class), -1);
96+
Mockito.mock(CWLToolRunner.class),
97+
Mockito.mock(GitSemaphore.class), -1);
9598

9699
// Will use check cache algorithm, find expired,
97100
// check git and find commit IDs do not match,
@@ -128,7 +131,8 @@ public void getROBundle() throws Exception {
128131
mockWorkflowRepo, Mockito.mock(QueuedWorkflowRepository.class),
129132
Mockito.mock(ROBundleFactory.class),
130133
Mockito.mock(GraphVizService.class),
131-
Mockito.mock(CWLToolRunner.class), -1);
134+
Mockito.mock(CWLToolRunner.class),
135+
Mockito.mock(GitSemaphore.class), -1);
132136

133137
File fetchedBundle = testWorkflowService.getROBundle(Mockito.mock(GitDetails.class));
134138
assertEquals(roBundlePath, fetchedBundle.getAbsolutePath());

0 commit comments

Comments
 (0)