switch to JUnit5 v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 04 Mar 2019 22:20:36 +0100
branchv_0
changeset 241f332033ed66c
parent 240 09c72e23c895
child 242 0503996934e0
switch to JUnit5
java/sql-dk/pom.xml
java/sql-dk/src/test/java/info/globalcode/sql/dk/CLIParserTest.java
java/sql-dk/src/test/java/info/globalcode/sql/dk/FunctionsTest.java
     1.1 --- a/java/sql-dk/pom.xml	Mon Mar 04 22:11:11 2019 +0100
     1.2 +++ b/java/sql-dk/pom.xml	Mon Mar 04 22:20:36 2019 +0100
     1.3 @@ -6,21 +6,28 @@
     1.4  	<version>0.10-SNAPSHOT</version>
     1.5  	<packaging>jar</packaging>
     1.6  	
     1.7 -	<dependencies>
     1.8 -		<dependency>
     1.9 -			<groupId>org.testng</groupId>
    1.10 -			<artifactId>testng</artifactId>
    1.11 -			<version>6.9.9</version>
    1.12 -			<scope>test</scope>
    1.13 -		</dependency>
    1.14 -	</dependencies>
    1.15 -	
    1.16  	<properties>
    1.17  		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    1.18  		<maven.compiler.source>1.8</maven.compiler.source>
    1.19  		<maven.compiler.target>1.8</maven.compiler.target>
    1.20 +		<junit.version>5.4.0</junit.version>
    1.21  	</properties>
    1.22  	
    1.23 +	<dependencies>
    1.24 +		<dependency>
    1.25 +			<groupId>org.junit.jupiter</groupId>
    1.26 +			<artifactId>junit-jupiter-engine</artifactId>
    1.27 +			<version>${junit.version}</version>
    1.28 +			<scope>test</scope>
    1.29 +		</dependency>
    1.30 +		<dependency>
    1.31 +			<groupId>org.junit.jupiter</groupId>
    1.32 +			<artifactId>junit-jupiter-params</artifactId>
    1.33 +			<version>${junit.version}</version>
    1.34 +			<scope>test</scope>
    1.35 +		</dependency>
    1.36 +	</dependencies>
    1.37 +	
    1.38  	<build>
    1.39  		<plugins>
    1.40  			<plugin>
    1.41 @@ -63,6 +70,22 @@
    1.42  					</execution>
    1.43  				</executions>
    1.44  			</plugin>
    1.45 +			<plugin>
    1.46 +				<!--
    1.47 +					Without this, tests are executed as „POJO Tests“ instead of „JUnit5 Tests“
    1.48 +					and @BeforeEach annotation does not work.
    1.49 +					http://maven.apache.org/surefire/maven-surefire-plugin/examples/pojo-test.html
    1.50 +				-->
    1.51 +				<artifactId>maven-surefire-plugin</artifactId>
    1.52 +				<version>2.22.0</version>
    1.53 +				<dependencies>
    1.54 +					<dependency>
    1.55 +						<groupId>org.junit.platform</groupId>
    1.56 +						<artifactId>junit-platform-surefire-provider</artifactId>
    1.57 +						<version>1.2.0</version>
    1.58 +					</dependency>
    1.59 +				</dependencies>
    1.60 +			</plugin>
    1.61  		</plugins>
    1.62  	</build>
    1.63  	
     2.1 --- a/java/sql-dk/src/test/java/info/globalcode/sql/dk/CLIParserTest.java	Mon Mar 04 22:11:11 2019 +0100
     2.2 +++ b/java/sql-dk/src/test/java/info/globalcode/sql/dk/CLIParserTest.java	Mon Mar 04 22:20:36 2019 +0100
     2.3 @@ -22,9 +22,9 @@
     2.4  import info.globalcode.sql.dk.InfoLister.InfoType;
     2.5  import java.io.ByteArrayInputStream;
     2.6  import java.util.Collection;
     2.7 -import static org.testng.Assert.*;
     2.8 -import org.testng.annotations.BeforeMethod;
     2.9 -import org.testng.annotations.Test;
    2.10 +import org.junit.jupiter.api.BeforeEach;
    2.11 +import org.junit.jupiter.api.Test;
    2.12 +import static org.junit.jupiter.api.Assertions.*;
    2.13  
    2.14  /**
    2.15   *
    2.16 @@ -42,7 +42,7 @@
    2.17  	private static final String NAME_3 = "param3";
    2.18  	private CLIParser parser;
    2.19  
    2.20 -	@BeforeMethod
    2.21 +	@BeforeEach
    2.22  	public void setUpMethod() throws Exception {
    2.23  		parser = new CLIParser();
    2.24  	}
     3.1 --- a/java/sql-dk/src/test/java/info/globalcode/sql/dk/FunctionsTest.java	Mon Mar 04 22:11:11 2019 +0100
     3.2 +++ b/java/sql-dk/src/test/java/info/globalcode/sql/dk/FunctionsTest.java	Mon Mar 04 22:20:36 2019 +0100
     3.3 @@ -20,8 +20,8 @@
     3.4  import java.util.ArrayList;
     3.5  import java.util.Collection;
     3.6  import java.util.List;
     3.7 -import static org.testng.Assert.*;
     3.8 -import org.testng.annotations.*;
     3.9 +import org.junit.jupiter.api.Test;
    3.10 +import static org.junit.jupiter.api.Assertions.*;
    3.11  
    3.12  /**
    3.13   *