Skip to content

chore(deps): Upgrade to JUnit 5 #314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: maven # Update pom.xml dependencies and plugins weekly
directory: "/"
schedule:
interval: weekly
20 changes: 10 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
</licenses>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId>
Expand Down Expand Up @@ -72,7 +72,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<version>3.6.2</version>
<configuration>
<javadocVersion>1.8</javadocVersion>
<failOnError>false</failOnError>
Expand All @@ -91,12 +91,12 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<version>3.2.2</version>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
<additionalClasspathElements>
Expand All @@ -109,7 +109,7 @@
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr3-maven-plugin</artifactId>
<version>3.5.2</version>
<version>3.5.3</version>
<configuration>
<sourceDirectory>src</sourceDirectory>
<libDirectory>src/org/stringtemplate/v4/compiler</libDirectory>
Expand Down
10 changes: 5 additions & 5 deletions test/org/stringtemplate/v4/test/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
*/
package org.stringtemplate.v4.test;

import java.util.concurrent.atomic.AtomicInteger;
import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.Token;
import org.junit.Before;
import org.junit.jupiter.api.BeforeEach;
import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;
import org.stringtemplate.v4.compiler.Compiler;
Expand All @@ -55,11 +54,12 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;


public abstract class BaseTest {
Expand Down Expand Up @@ -117,7 +117,7 @@ public String toString() {
}
}

@Before
@BeforeEach
public void setUp() {
STGroup.defaultGroup = new STGroup();
Compiler.subtemplateCount = new AtomicInteger(0);
Expand Down
4 changes: 2 additions & 2 deletions test/org/stringtemplate/v4/test/TestAggregates.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@

package org.stringtemplate.v4.test;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;
import org.stringtemplate.v4.STGroupString;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

/** */
public class TestAggregates extends BaseTest {
Expand Down
4 changes: 2 additions & 2 deletions test/org/stringtemplate/v4/test/TestAttributes.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.stringtemplate.v4.test;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.stringtemplate.v4.ST;

import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class TestAttributes extends BaseTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package org.stringtemplate.v4.test;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;
import org.stringtemplate.v4.STGroupFile;
import org.stringtemplate.v4.misc.ErrorBuffer;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class TestBuggyDefaultValueRaisesNPETest extends BaseTest {
/**
* When the anonymous template specified as a default value for a formalArg
Expand All @@ -28,7 +29,7 @@ public void testHandleBuggyDefaultArgument() throws Exception {
String s = st.render();

// Check the errors. This contained an "NullPointerException" before
Assert.assertEquals(
assertEquals(
"t.stg 1:12: mismatched input ')' expecting RDELIM"+newline,
errors.toString());
}
Expand Down
4 changes: 2 additions & 2 deletions test/org/stringtemplate/v4/test/TestCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
*/
package org.stringtemplate.v4.test;

import org.junit.*;
import org.junit.jupiter.api.Test;
import org.stringtemplate.v4.*;
import org.stringtemplate.v4.compiler.*;
import org.stringtemplate.v4.compiler.Compiler;
import org.stringtemplate.v4.misc.*;

import java.util.Arrays;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class TestCompiler extends BaseTest {

Expand Down
4 changes: 2 additions & 2 deletions test/org/stringtemplate/v4/test/TestCoreBasics.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
*/
package org.stringtemplate.v4.test;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.stringtemplate.v4.AutoIndentWriter;
import org.stringtemplate.v4.NoIndentWriter;
import org.stringtemplate.v4.ST;
Expand All @@ -45,7 +45,7 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
import java.util.List;
import java.util.Map;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class TestCoreBasics extends BaseTest {
@Test public void testNullAttr() throws Exception {
Expand Down
4 changes: 2 additions & 2 deletions test/org/stringtemplate/v4/test/TestDebugEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
*/
package org.stringtemplate.v4.test;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.stringtemplate.v4.*;
import org.stringtemplate.v4.debug.InterpEvent;

import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class TestDebugEvents extends BaseTest {
@Test public void testString() throws Exception {
Expand Down
14 changes: 7 additions & 7 deletions test/org/stringtemplate/v4/test/TestDictionaries.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
*/
package org.stringtemplate.v4.test;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;
import org.stringtemplate.v4.STGroupFile;
Expand All @@ -39,7 +38,8 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
import java.util.HashMap;
import java.util.Map;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

public class TestDictionaries extends BaseTest {
@Test public void testDict() throws Exception {
Expand Down Expand Up @@ -375,12 +375,12 @@ public class TestDictionaries extends BaseTest {
writeFile(tmpdir, "t.stg", templates);
STGroup group = new STGroupFile(tmpdir + File.separatorChar + "t.stg");
ST st = group.getInstanceOf("top");
Assert.assertNotNull(st);
assertNotNull(st);
String expecting =
" electric <field>" + newline +
" <field> force" + newline +
" in <field> between";
Assert.assertEquals(expecting, st.render());
assertEquals(expecting, st.render());
}

@Test public void testTemplatesInDictionary() throws Exception {
Expand All @@ -404,12 +404,12 @@ public class TestDictionaries extends BaseTest {
writeFile(tmpdir, "t.stg", templates);
STGroup group = new STGroupFile(tmpdir + File.separatorChar + "t.stg");
ST st = group.getInstanceOf("top");
Assert.assertNotNull(st);
assertNotNull(st);
String expecting =
" electric foo" + newline +
" foo force" + newline +
" in foo between";
Assert.assertEquals(expecting, st.render());
assertEquals(expecting, st.render());
}

@Test
Expand Down
22 changes: 11 additions & 11 deletions test/org/stringtemplate/v4/test/TestDollarDelimiters.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@

package org.stringtemplate.v4.test;

import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;
import org.stringtemplate.v4.STGroupFile;
import org.stringtemplate.v4.STGroupString;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

public class TestDollarDelimiters extends BaseTest {
@Test public void testAttr() throws Exception {
Expand Down Expand Up @@ -158,14 +158,14 @@ public void testImportTemplatePreservesDelimiters() {

// test html template directly
ST st = group.getInstanceOf("html");
Assert.assertNotNull(st);
assertNotNull(st);
String expected = "<table style=\"stuff\">";
String result = st.render();
assertEquals(expected, result);

// test from entry template
st = group.getInstanceOf("entry");
Assert.assertNotNull(st);
assertNotNull(st);
expected = "<table style=\"stuff\">";
result = st.render();
assertEquals(expected, result);
Expand Down Expand Up @@ -196,14 +196,14 @@ public void testImportGroupPreservesDelimiters() {

// test html template directly
ST st = group.getInstanceOf("html");
Assert.assertNotNull(st);
assertNotNull(st);
String expected = "<table style=\"stuff\">";
String result = st.render();
assertEquals(expected, result);

// test from entry template
st = group.getInstanceOf("entry");
Assert.assertNotNull(st);
assertNotNull(st);
expected = "<table style=\"stuff\">";
result = st.render();
assertEquals(expected, result);
Expand Down Expand Up @@ -235,14 +235,14 @@ public void testDelimitersClauseOverridesConstructorDelimiters() {

// test html template directly
ST st = group.getInstanceOf("html");
Assert.assertNotNull(st);
assertNotNull(st);
String expected = "<table style=\"stuff\">";
String result = st.render();
assertEquals(expected, result);

// test from entry template
st = group.getInstanceOf("entry");
Assert.assertNotNull(st);
assertNotNull(st);
expected = "<table style=\"stuff\">";
result = st.render();
assertEquals(expected, result);
Expand Down Expand Up @@ -275,14 +275,14 @@ public void testDelimitersClauseOverridesInheritedDelimiters() {

// test html template directly
ST st = group.getInstanceOf("html");
Assert.assertNotNull(st);
assertNotNull(st);
String expected = "<table style=\"stuff\">";
String result = st.render();
assertEquals(expected, result);

// test from entry template
st = group.getInstanceOf("entry");
Assert.assertNotNull(st);
assertNotNull(st);
expected = "<table style=\"stuff\">";
result = st.render();
assertEquals(expected, result);
Expand Down
Loading