Skip to content

Commit 2c67247

Browse files
committed
replaced all junit 3 and 4 with junit 5 stuff
1 parent fce5b99 commit 2c67247

File tree

123 files changed

+1046
-1231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1046
-1231
lines changed

pom.xml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
<scope>test</scope>
3939
</dependency>
4040
<dependency>
41-
<groupId>org.junit.vintage</groupId>
42-
<artifactId>junit-vintage-engine</artifactId>
43-
<version>5.8.1</version>
44-
<scope>test</scope>
41+
<groupId>org.mockito</groupId>
42+
<artifactId>mockito-core</artifactId>
43+
<version>3.12.4</version>
44+
<scope>test</scope>
4545
</dependency>
4646
<dependency>
4747
<groupId>org.mockito</groupId>
48-
<artifactId>mockito-core</artifactId>
48+
<artifactId>mockito-junit-jupiter</artifactId>
4949
<version>3.12.4</version>
5050
<scope>test</scope>
5151
</dependency>
@@ -67,7 +67,12 @@
6767
<version>1.4.200</version>
6868
<scope>test</scope>
6969
</dependency>
70-
70+
<dependency>
71+
<groupId>org.hamcrest</groupId>
72+
<artifactId>hamcrest-all</artifactId>
73+
<version>1.3</version>
74+
<scope>test</scope>
75+
</dependency>
7176
</dependencies>
7277

7378
<developers>

src/test/java/net/sf/jsqlparser/expression/CastExpressionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import net.sf.jsqlparser.JSQLParserException;
1414
import net.sf.jsqlparser.test.TestUtils;
15-
import org.junit.Test;
15+
import org.junit.jupiter.api.Test;
1616

1717
/**
1818
*

src/test/java/net/sf/jsqlparser/expression/ExpressionPrecedenceTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseAnd;
1414
import net.sf.jsqlparser.expression.operators.arithmetic.Concat;
1515
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
16-
import static org.junit.Assert.assertTrue;
17-
import org.junit.Test;
16+
import static org.junit.jupiter.api.Assertions.assertTrue;
17+
18+
import org.junit.jupiter.api.Test;
1819

1920
/**
2021
*

src/test/java/net/sf/jsqlparser/expression/ExpressionVisitorAdapterTest.java

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,31 @@
1515
import net.sf.jsqlparser.expression.operators.conditional.XorExpression;
1616
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;
1717
import net.sf.jsqlparser.statement.select.SubSelect;
18-
import org.junit.After;
19-
import org.junit.AfterClass;
20-
import org.junit.Before;
21-
import org.junit.BeforeClass;
22-
import org.junit.Test;
23-
import static org.junit.Assert.assertEquals;
24-
import static org.junit.Assert.assertNotNull;
25-
import static org.junit.Assert.assertTrue;
26-
import static org.junit.Assert.fail;
18+
19+
20+
21+
22+
import org.junit.jupiter.api.Test;
23+
24+
25+
26+
2727
import net.sf.jsqlparser.JSQLParserException;
2828
import net.sf.jsqlparser.expression.operators.relational.InExpression;
2929
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
3030
import net.sf.jsqlparser.schema.Column;
3131
import net.sf.jsqlparser.statement.select.PlainSelect;
3232
import net.sf.jsqlparser.statement.select.Select;
3333
import net.sf.jsqlparser.statement.select.SelectVisitorAdapter;
34+
import static org.junit.jupiter.api.Assertions.assertEquals;
35+
import static org.junit.jupiter.api.Assertions.assertNotNull;
36+
import static org.junit.jupiter.api.Assertions.assertTrue;
37+
import static org.junit.jupiter.api.Assertions.fail;
3438

3539
/**
3640
* @author tw
3741
*/
3842
public class ExpressionVisitorAdapterTest {
39-
40-
public ExpressionVisitorAdapterTest() {
41-
}
42-
43-
@BeforeClass
44-
public static void setUpClass() {
45-
}
46-
47-
@AfterClass
48-
public static void tearDownClass() {
49-
}
50-
51-
@Before
52-
public void setUp() {
53-
}
54-
55-
@After
56-
public void tearDown() {
57-
}
58-
5943
@Test
6044
public void testInExpressionProblem() throws JSQLParserException {
6145
final List<Object> exprList = new ArrayList<>();

src/test/java/net/sf/jsqlparser/expression/FunctionWithBooleanParameterTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
package net.sf.jsqlparser.expression;
1111

1212
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
13-
import static org.junit.Assert.assertEquals;
14-
import org.junit.Test;
13+
import static org.junit.jupiter.api.Assertions.assertEquals;
14+
15+
import org.junit.jupiter.api.Test;
1516

1617
/**
1718
* Test some cases linked to a boolean (condition) argument as function parameter.

src/test/java/net/sf/jsqlparser/expression/JsonFunctionTest.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@
1111
package net.sf.jsqlparser.expression;
1212

1313
import java.util.Objects;
14-
import junit.framework.Assert;
1514
import net.sf.jsqlparser.JSQLParserException;
1615
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
1716
import net.sf.jsqlparser.test.TestUtils;
18-
import org.junit.Test;
17+
import org.junit.jupiter.api.Test;
1918
import org.junit.jupiter.api.Assertions;
19+
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
import static org.junit.jupiter.api.Assertions.assertFalse;
21+
import static org.junit.jupiter.api.Assertions.assertNotNull;
22+
import static org.junit.jupiter.api.Assertions.assertTrue;
2023

2124
/**
2225
*
@@ -66,17 +69,17 @@ public void testObjectBuilder() throws JSQLParserException {
6669
JsonKeyValuePair keyValuePair2 = new JsonKeyValuePair("foo", "bar", false, false).withUsingKeyKeyword(true).withUsingValueKeyword(true).withUsingFormatJson(false);
6770

6871
// this should work because we compare based on KEY only
69-
Assert.assertEquals(keyValuePair1, keyValuePair2);
72+
assertEquals(keyValuePair1, keyValuePair2);
7073

7174
// this must fail because all the properties are considered
72-
Assert.assertFalse(Objects.equals(keyValuePair1.toString(), keyValuePair2.toString()));
75+
assertFalse(Objects.equals(keyValuePair1.toString(), keyValuePair2.toString()));
7376

7477
JsonKeyValuePair keyValuePair3 = new JsonKeyValuePair("foo", "bar", false, false).withUsingKeyKeyword(false).withUsingValueKeyword(false).withUsingFormatJson(false);
75-
Assert.assertNotNull(keyValuePair3 );
76-
Assert.assertEquals(keyValuePair3, keyValuePair3);
77-
Assert.assertFalse(Objects.equals( keyValuePair3, f));
78+
assertNotNull(keyValuePair3 );
79+
assertEquals(keyValuePair3, keyValuePair3);
80+
assertFalse(Objects.equals( keyValuePair3, f));
7881

79-
Assert.assertTrue(keyValuePair3.hashCode()!=0);
82+
assertTrue(keyValuePair3.hashCode()!=0);
8083

8184
f.add(keyValuePair2);
8285
}
@@ -92,7 +95,7 @@ public void testArrayBuilder() throws JSQLParserException {
9295
JsonFunctionExpression expression2 = new JsonFunctionExpression(new NullValue()).withUsingFormatJson(
9396
true);
9497

95-
Assert.assertTrue(Objects.equals(expression1.toString(), expression2.toString()));
98+
assertTrue(Objects.equals(expression1.toString(), expression2.toString()));
9699

97100
f.add(expression1);
98101
f.add(expression2);

src/test/java/net/sf/jsqlparser/expression/LikeExpressionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import net.sf.jsqlparser.JSQLParserException;
1414
import net.sf.jsqlparser.test.TestUtils;
15-
import org.junit.Test;
15+
import org.junit.jupiter.api.Test;
1616

1717
/**
1818
*

src/test/java/net/sf/jsqlparser/expression/LimitExpressionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import net.sf.jsqlparser.statement.select.PlainSelect;
1515
import net.sf.jsqlparser.statement.select.Select;
1616
import net.sf.jsqlparser.test.TestUtils;
17-
import org.junit.Test;
17+
import org.junit.jupiter.api.Test;
1818
import org.junit.jupiter.api.Assertions;
1919

2020
/**

src/test/java/net/sf/jsqlparser/expression/LongValueTest.java

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,20 @@
1010
package net.sf.jsqlparser.expression;
1111

1212
import java.math.BigInteger;
13-
import org.junit.After;
14-
import org.junit.AfterClass;
15-
import org.junit.Before;
16-
import org.junit.BeforeClass;
17-
import org.junit.Test;
18-
import static org.junit.Assert.*;
13+
import static org.junit.jupiter.api.Assertions.assertEquals;
14+
import static org.junit.jupiter.api.Assertions.fail;
1915

20-
/**
21-
*
22-
* @author tw
23-
*/
24-
public class LongValueTest {
25-
26-
public LongValueTest() {
27-
}
2816

29-
@BeforeClass
30-
public static void setUpClass() {
31-
}
3217

33-
@AfterClass
34-
public static void tearDownClass() {
35-
}
3618

37-
@Before
38-
public void setUp() {
39-
}
19+
import org.junit.jupiter.api.Test;
4020

41-
@After
42-
public void tearDown() {
43-
}
4421

22+
/**
23+
*
24+
* @author tw
25+
*/
26+
public class LongValueTest {
4527
@Test
4628
public void testSimpleNumber() {
4729
LongValue value = new LongValue("123");

src/test/java/net/sf/jsqlparser/expression/OracleNamedFunctionParameterTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@
1919
import net.sf.jsqlparser.util.TablesNamesFinder;
2020
import net.sf.jsqlparser.util.validation.ValidationTestAsserts;
2121
import net.sf.jsqlparser.util.validation.feature.DatabaseType;
22-
import org.junit.Assert;
23-
import org.junit.Test;
22+
import net.sf.jsqlparser.util.validation.validator.ExpressionValidator;
23+
import static org.junit.jupiter.api.Assertions.assertEquals;
24+
import static org.junit.jupiter.api.Assertions.assertTrue;
25+
26+
import org.junit.jupiter.api.Test;
2427

2528
/**
2629
*
@@ -81,8 +84,8 @@ public void testTableNamesFinder() throws JSQLParserException {
8184

8285
Statement statement = CCJSqlParserUtil.parse(sqlStr);
8386
List<String> tables = new TablesNamesFinder().getTableList(statement);
84-
Assert.assertEquals(1, tables.size());
85-
Assert.assertTrue(tables.contains("test_table"));
87+
assertEquals(1, tables.size());
88+
assertTrue(tables.contains("test_table"));
8689
}
8790

8891
/**

0 commit comments

Comments
 (0)