Skip to content

Commit 3c4bf3b

Browse files
kinowmr-c
authored andcommitted
Fix compilation issues
1 parent bdb15d2 commit 3c4bf3b

22 files changed

+156
-158
lines changed

src/test/java/org/commonwl/view/CwlViewerApplicationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
package org.commonwl.view;
2121

22-
import org.junit.Test;
23-
import org.junit.runner.RunWith;
22+
import org.junit.jupiter.api.Test;
23+
import org.junit.jupiter.api.extension.ExtendWith;
2424
import org.springframework.boot.test.context.SpringBootTest;
25-
import org.springframework.test.context.junit4.SpringRunner;
25+
import org.springframework.test.context.junit.jupiter.SpringExtension;
2626

27-
@RunWith(SpringRunner.class)
27+
@ExtendWith(SpringExtension.class)
2828
@SpringBootTest
2929
public class CwlViewerApplicationTests {
3030

src/test/java/org/commonwl/view/PageControllerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
package org.commonwl.view;
2121

22-
import org.junit.Before;
23-
import org.junit.Test;
22+
import org.junit.jupiter.api.BeforeEach;
23+
import org.junit.jupiter.api.Test;
2424
import org.springframework.test.web.servlet.MockMvc;
2525
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
2626
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@@ -34,7 +34,7 @@ public class PageControllerTest {
3434

3535
private MockMvc mockMvc;
3636

37-
@Before
37+
@BeforeEach
3838
public void setup() {
3939
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
4040
viewResolver.setPrefix("/src/main/resources/templates/");

src/test/java/org/commonwl/view/cwl/CWLElementTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919

2020
package org.commonwl.view.cwl;
2121

22-
import org.junit.Test;
22+
import org.junit.jupiter.api.Test;
2323

2424
import java.util.List;
2525

26-
import static org.junit.Assert.assertEquals;
26+
import static org.junit.jupiter.api.Assertions.assertEquals;
2727

2828
public class CWLElementTest {
2929

src/test/java/org/commonwl/view/cwl/CWLProcessTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
package org.commonwl.view.cwl;
2121

22-
import org.junit.Test;
22+
import org.junit.jupiter.api.Test;
2323

24-
import static org.junit.Assert.assertEquals;
24+
import static org.junit.jupiter.api.Assertions.assertEquals;
2525

2626
public class CWLProcessTest {
2727

src/test/java/org/commonwl/view/cwl/CWLServiceTest.java

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,28 @@
1919

2020
package org.commonwl.view.cwl;
2121

22-
import org.apache.jena.query.*;
22+
import org.apache.jena.query.Dataset;
23+
import org.apache.jena.query.DatasetFactory;
24+
import org.apache.jena.query.Query;
25+
import org.apache.jena.query.QueryExecution;
26+
import org.apache.jena.query.QueryExecutionFactory;
27+
import org.apache.jena.query.QueryFactory;
28+
import org.apache.jena.query.ResultSet;
29+
import org.apache.jena.query.ResultSetFactory;
2330
import org.apache.jena.rdf.model.Model;
2431
import org.apache.jena.rdf.model.ModelFactory;
2532
import org.commonwl.view.git.GitDetails;
2633
import org.commonwl.view.workflow.Workflow;
2734
import org.commonwl.view.workflow.WorkflowOverview;
28-
import org.junit.Before;
29-
import org.junit.Rule;
30-
import org.junit.Test;
31-
import org.junit.rules.ExpectedException;
32-
import org.junit.runner.RunWith;
35+
import org.junit.jupiter.api.Assertions;
36+
import org.junit.jupiter.api.BeforeEach;
37+
import org.junit.jupiter.api.Test;
38+
import org.junit.jupiter.api.extension.ExtendWith;
3339
import org.mockito.Mockito;
3440
import org.mockito.invocation.InvocationOnMock;
3541
import org.mockito.stubbing.Answer;
3642
import org.springframework.boot.test.context.SpringBootTest;
37-
import org.springframework.test.context.junit4.SpringRunner;
43+
import org.springframework.test.context.junit.jupiter.SpringExtension;
3844

3945
import java.io.ByteArrayInputStream;
4046
import java.io.File;
@@ -44,12 +50,15 @@
4450
import java.util.Map;
4551

4652
import static org.apache.commons.io.FileUtils.readFileToString;
47-
import static org.junit.Assert.*;
53+
import static org.junit.jupiter.api.Assertions.assertEquals;
54+
import static org.junit.jupiter.api.Assertions.assertNotNull;
55+
import static org.junit.jupiter.api.Assertions.assertNull;
56+
import static org.junit.jupiter.api.Assertions.assertTrue;
4857
import static org.mockito.Matchers.anyObject;
4958
import static org.mockito.Matchers.anyString;
5059
import static org.mockito.Mockito.when;
5160

52-
@RunWith(SpringRunner.class)
61+
@ExtendWith(SpringExtension.class)
5362
@SpringBootTest
5463
public class CWLServiceTest {
5564

@@ -58,7 +67,7 @@ public class CWLServiceTest {
5867
*/
5968
private RDFService rdfService;
6069

61-
@Before
70+
@BeforeEach
6271
public void setUp() throws Exception {
6372
File packedWorkflowRdf = new File("src/test/resources/cwl/make_to_cwl/dna.ttl");
6473
Model workflowModel = ModelFactory.createDefaultModel();
@@ -82,12 +91,6 @@ public ResultSet answer(InvocationOnMock invocation) throws Throwable {
8291
Mockito.doReturn(true).when(rdfService).graphExists(anyString());
8392
}
8493

85-
/**
86-
* Used for expected IOExceptions for filesize limits
87-
*/
88-
@Rule
89-
public ExpectedException thrown = ExpectedException.none();
90-
9194
@Test
9295
public void parsePackedWorkflowNativePath() throws Exception {
9396
CWLService cwlService = new CWLService(rdfService, Mockito.mock(CWLTool.class), 5242880);
@@ -180,13 +183,12 @@ public void parseWorkflowWithCwltool() throws Exception {
180183
public void workflowOverSingleFileSizeLimitThrowsIOException() throws Exception {
181184

182185
// Should throw IOException due to oversized files
183-
thrown.expect(IOException.class);
184-
thrown.expectMessage("File 'lobSTR-workflow.cwl' is over singleFileSizeLimit - 2 KB/0 bytes");
185-
186-
CWLService cwlService = new CWLService(rdfService, Mockito.mock(CWLTool.class), 0);
187-
cwlService.parseWorkflowNative(
188-
Paths.get("src/test/resources/cwl/lobstr-draft3/lobSTR-workflow.cwl"), null);
189-
186+
Exception thrown = Assertions.assertThrows(IOException.class, () -> {
187+
CWLService cwlService = new CWLService(rdfService, Mockito.mock(CWLTool.class), 0);
188+
cwlService.parseWorkflowNative(
189+
Paths.get("src/test/resources/cwl/lobstr-draft3/lobSTR-workflow.cwl"), null);
190+
});
191+
assertEquals("File 'lobSTR-workflow.cwl' is over singleFileSizeLimit - 2 KB/0 bytes", thrown.getMessage());
190192
}
191193

192194
/**
@@ -216,19 +218,17 @@ public void getHelloWorkflowOverview() throws Exception {
216218
*/
217219
@Test
218220
public void workflowOverviewOverSingleFileSizeLimitThrowsIOException() throws Exception {
219-
220-
// Test cwl service
221-
CWLService cwlService = new CWLService(Mockito.mock(RDFService.class),
222-
Mockito.mock(CWLTool.class), 0);
223-
224221
// File to test
225222
File helloWorkflow = new File("src/test/resources/cwl/hello/hello.cwl");
226223

227-
// Should throw IOException due to oversized file
228-
thrown.expect(IOException.class);
229-
thrown.expectMessage(String.format("File 'hello.cwl' is over singleFileSizeLimit - %s bytes/0 bytes",
230-
helloWorkflow.length()));
231-
cwlService.getWorkflowOverview(helloWorkflow);
224+
// Test cwl service
225+
Exception thrown = Assertions.assertThrows(IOException.class, () -> {
226+
CWLService cwlService = new CWLService(Mockito.mock(RDFService.class),
227+
Mockito.mock(CWLTool.class), 0);
228+
cwlService.getWorkflowOverview(helloWorkflow);
229+
});
230+
assertEquals(String.format("File 'hello.cwl' is over singleFileSizeLimit - %s bytes/0 bytes",
231+
helloWorkflow.length()), thrown.getMessage());
232232

233233
}
234234

src/test/java/org/commonwl/view/cwl/RDFServiceTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
package org.commonwl.view.cwl;
2121

22-
import org.junit.Test;
23-
import org.junit.runner.RunWith;
22+
import org.junit.jupiter.api.Test;
23+
import org.junit.jupiter.api.extension.ExtendWith;
2424
import org.springframework.beans.factory.annotation.Autowired;
2525
import org.springframework.boot.test.context.SpringBootTest;
26-
import org.springframework.test.context.junit4.SpringRunner;
26+
import org.springframework.test.context.junit.jupiter.SpringExtension;
2727

28-
import static org.junit.Assert.assertEquals;
28+
import static org.junit.jupiter.api.Assertions.assertEquals;
2929

30-
@RunWith(SpringRunner.class)
30+
@ExtendWith(SpringExtension.class)
3131
@SpringBootTest
3232
public class RDFServiceTest {
3333

src/test/java/org/commonwl/view/docker/DockerServiceTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919

2020
package org.commonwl.view.docker;
2121

22-
import org.junit.Before;
23-
import org.junit.Test;
22+
import org.junit.jupiter.api.BeforeEach;
23+
import org.junit.jupiter.api.Test;
2424

25-
import static org.junit.Assert.assertEquals;
26-
import static org.junit.Assert.assertNull;
25+
import static org.junit.jupiter.api.Assertions.assertEquals;
26+
import static org.junit.jupiter.api.Assertions.assertNull;
2727

2828
public class DockerServiceTest {
2929

@@ -32,7 +32,7 @@ public class DockerServiceTest {
3232
/**
3333
* New instance of DockerService
3434
*/
35-
@Before
35+
@BeforeEach
3636
public void setUp() throws Exception {
3737
dockerService = new DockerService();
3838
}

src/test/java/org/commonwl/view/git/GitDetailsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020
package org.commonwl.view.git;
2121

22-
import org.junit.Test;
22+
import org.junit.jupiter.api.Test;
2323

2424
import static org.commonwl.view.git.GitDetails.normaliseUrl;
25-
import static org.junit.Assert.assertEquals;
25+
import static org.junit.jupiter.api.Assertions.assertEquals;
2626

2727
public class GitDetailsTest {
2828

src/test/java/org/commonwl/view/git/GitSemaphoreTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020
package org.commonwl.view.git;
2121

22-
import org.junit.Test;
22+
import org.junit.jupiter.api.Test;
2323

24-
import static junit.framework.TestCase.assertFalse;
25-
import static junit.framework.TestCase.assertTrue;
24+
import static org.junit.jupiter.api.Assertions.assertFalse;
25+
import static org.junit.jupiter.api.Assertions.assertTrue;
2626

2727
public class GitSemaphoreTest {
2828

src/test/java/org/commonwl/view/git/GitServiceTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
import org.eclipse.jgit.api.Git;
2727
import org.eclipse.jgit.api.errors.GitAPIException;
2828
import org.eclipse.jgit.api.errors.RefNotFoundException;
29-
import org.junit.Before;
30-
import org.junit.Test;
29+
import org.junit.jupiter.api.BeforeEach;
30+
import org.junit.jupiter.api.Test;
3131
import org.mockito.Mockito;
3232

33-
import static org.junit.Assert.assertEquals;
34-
import static org.junit.Assert.assertNotNull;
35-
import static org.junit.Assert.assertTrue;
33+
import static org.junit.jupiter.api.Assertions.assertEquals;
34+
import static org.junit.jupiter.api.Assertions.assertNotNull;
35+
import static org.junit.jupiter.api.Assertions.assertTrue;
3636
import static org.mockito.Mockito.doReturn;
3737
import static org.mockito.Mockito.mock;
3838
import static org.mockito.Mockito.spy;
@@ -50,7 +50,7 @@ public class GitServiceTest {
5050
private CheckoutCommand mockTagNotFoundCommand;
5151
private CheckoutCommand mockCheckoutCommand;
5252

53-
@Before
53+
@BeforeEach
5454
public void setup() throws GitAPIException {
5555
GitService gitService = new GitService(null, false);
5656
this.spyGitService = spy(gitService);

0 commit comments

Comments
 (0)