Skip to content

Commit c9e3b75

Browse files
committed
unit test was refactored for JUnit5
1 parent ce6f789 commit c9e3b75

36 files changed

Lines changed: 416 additions & 434 deletions

pom.xml

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,16 @@
33

44
<groupId>com.scriptbasic</groupId>
55
<artifactId>jscriptbasic</artifactId>
6-
<version>2.0.0</version>
6+
<version>2.0.0-SNAPSHOT</version>
77
<packaging>jar</packaging>
88

9-
<parent>
10-
<groupId>org.sonatype.oss</groupId>
11-
<artifactId>oss-parent</artifactId>
12-
<version>7</version>
13-
</parent>
14-
159
<name>ScriptBasic for Java</name>
1610
<url>http://www.scriptbasic.com</url>
1711
<organization>
1812
<name>Verhas and Verhas Software Craftsmen</name>
1913
<url>http://www.verhas.com</url>
2014
</organization>
21-
<description>ScriptBasic for Java is an implementation of ScriptBasic for the Java technology, language and
22-
users.
23-
For more information have a look at the site documentation, and use the menu items on the left side.
24-
15+
<description>ScriptBasic for Java is an implementation of ScriptBasic for the Java technology, language and users.
2516
</description>
2617
<issueManagement>
2718
<url>https://github.com/verhas/jScriptBasic/issues</url>
@@ -48,7 +39,6 @@
4839
</developer>
4940
</developers>
5041
<properties>
51-
<powermock.version>1.4.12</powermock.version>
5242
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5343
</properties>
5444
<build>
@@ -66,7 +56,7 @@
6656
<plugin>
6757
<groupId>org.apache.maven.plugins</groupId>
6858
<artifactId>maven-jar-plugin</artifactId>
69-
<version>3.0.2</version>
59+
<version>3.1.0</version>
7060
<configuration>
7161
<archive>
7262
<manifestEntries>
@@ -90,39 +80,23 @@
9080
</distributionManagement>
9181
<dependencies>
9282
<dependency>
93-
<groupId>junit</groupId>
94-
<artifactId>junit</artifactId>
95-
<version>4.12</version>
83+
<groupId>org.mockito</groupId>
84+
<artifactId>mockito-all</artifactId>
85+
<version>1.10.19</version>
9686
<scope>test</scope>
9787
</dependency>
9888
<dependency>
9989
<groupId>org.junit.jupiter</groupId>
10090
<artifactId>junit-jupiter-api</artifactId>
101-
<version>5.2.0</version>
91+
<version>5.3.1</version>
10292
<scope>test</scope>
10393
</dependency>
94+
<dependency>
95+
<groupId>org.junit.jupiter</groupId>
96+
<artifactId>junit-jupiter-engine</artifactId>
97+
<version>5.3.1</version>
98+
<scope>test</scope>
99+
</dependency>
100+
104101
</dependencies>
105-
<profiles>
106-
<profile>
107-
<id>sonatype-oss-release</id>
108-
<build>
109-
<plugins>
110-
<plugin>
111-
<groupId>org.apache.maven.plugins</groupId>
112-
<artifactId>maven-gpg-plugin</artifactId>
113-
<version>1.6</version>
114-
<executions>
115-
<execution>
116-
<id>sign-artifacts</id>
117-
<phase>verify</phase>
118-
<goals>
119-
<goal>sign</goal>
120-
</goals>
121-
</execution>
122-
</executions>
123-
</plugin>
124-
</plugins>
125-
</build>
126-
</profile>
127-
</profiles>
128102
</project>

src/test/java/com/scriptbasic/TestingExecutor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.scriptbasic.context.ContextBuilder;
66
import com.scriptbasic.interfaces.AnalysisException;
77
import com.scriptbasic.utility.functions.file.FileHandlingFunctions;
8-
import org.junit.Assert;
8+
import org.junit.jupiter.api.Assertions;
99

1010
import java.io.InputStreamReader;
1111
import java.io.StringReader;
@@ -67,7 +67,7 @@ public void execute(final String resourceName)
6767
}
6868

6969
public void assertOutput(final String s) {
70-
Assert.assertEquals(s, getSStdout());
70+
Assertions.assertEquals(s, getSStdout());
7171
}
7272

7373
}

src/test/java/com/scriptbasic/coverage/TestToExtendCoverage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.scriptbasic.coverage;
22

33
import com.scriptbasic.exceptions.BasicLexicalException;
4-
import org.junit.Test;
4+
import org.junit.jupiter.api.Test;
55

66

77
/**

src/test/java/com/scriptbasic/error/TestScriptBasicInternalError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.scriptbasic.error;
22

33
import com.scriptbasic.errors.BasicInterpreterInternalError;
4-
import org.junit.Test;
4+
import org.junit.jupiter.api.Test;
55

66
public class TestScriptBasicInternalError {
77
@Test

src/test/java/com/scriptbasic/exceptions/ExceptionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.scriptbasic.exceptions;
22

33
import com.scriptbasic.lexer.BasicLexicalElement;
4-
import org.junit.Test;
4+
import org.junit.jupiter.api.Test;
55

66
/**
77
* @author Peter Verhas

src/test/java/com/scriptbasic/executors/TestGenericLeftValueList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.scriptbasic.executors;
22

3-
import org.junit.Test;
3+
import org.junit.jupiter.api.Test;
44

55
/**
66
* @author Peter Verhas

src/test/java/com/scriptbasic/executors/TestInterpreterAwareMethodCall.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import com.scriptbasic.api.ScriptBasicException;
77
import com.scriptbasic.context.Context;
88
import com.scriptbasic.spi.Interpreter;
9-
import org.junit.Test;
9+
import org.junit.jupiter.api.Test;
1010

1111
import java.io.PrintWriter;
1212

13-
import static org.junit.Assert.assertEquals;
13+
import static org.junit.jupiter.api.Assertions.assertEquals;
1414

1515
public class TestInterpreterAwareMethodCall {
1616

src/test/java/com/scriptbasic/executors/TestMethodRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.scriptbasic.executors;
22

33
import com.scriptbasic.api.ScriptBasicException;
4-
import org.junit.Test;
4+
import org.junit.jupiter.api.Test;
55

66
import java.lang.reflect.Method;
77

8-
import static org.junit.Assert.assertNull;
8+
import static org.junit.jupiter.api.Assertions.*;
99

1010
/**
1111
* @author Peter Verhas

src/test/java/com/scriptbasic/executors/operators/SupportTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.scriptbasic.api.ScriptBasicException;
66
import com.scriptbasic.spi.Interpreter;
77

8-
import static org.junit.Assert.assertEquals;
8+
import static org.junit.jupiter.api.Assertions.*;
99

1010
class SupportTest {
1111

src/test/java/com/scriptbasic/executors/operators/TestJavaAccess.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
import com.scriptbasic.api.ScriptBasicException;
44
import com.scriptbasic.interfaces.AnalysisException;
5+
import com.scriptbasic.interfaces.BasicRuntimeException;
56
import com.scriptbasic.log.Logger;
67
import com.scriptbasic.log.LoggerFactory;
7-
import org.junit.Test;
8+
import org.junit.jupiter.api.Assertions;
9+
import org.junit.jupiter.api.Test;
810

911
import java.util.Arrays;
1012
import java.util.stream.Collectors;
@@ -51,18 +53,20 @@ public void canUseOverloadedMethodInsecureMode() throws Exception {
5153
"a=q.aint(1)"), 1);
5254
}
5355

54-
@Test(expected = ScriptBasicException.class)
56+
@Test()
5557
public void cannotUseOverloadedMethodSecureMode() throws Exception {
58+
Assertions.assertThrows(BasicRuntimeException.class, () ->
5659
executeSecure(program(
5760
"use OverloadedMethods from com.scriptbasic.executors.operators.TestJavaAccess as q"
58-
), null);
61+
), null));
5962
}
6063

61-
@Test(expected = ScriptBasicException.class)
64+
@Test()
6265
public void cannotMethodOverloadedMethodSecureMode() throws Exception {
66+
Assertions.assertThrows(BasicRuntimeException.class, () ->
6367
executeSecure(program(
6468
"method A from com.scriptbasic.executors.operators.TestJavaAccess.OverloadedMethods is (int) use as aint"
65-
), null);
69+
), null));
6670
}
6771

6872
@Test

0 commit comments

Comments
 (0)