Last active
February 24, 2016 04:26
-
-
Save up1/b8b85155e80c031fa8b4 to your computer and use it in GitHub Desktop.
Demo of JUnit 5 (Alpha)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.junit.gen5.api.Test; | |
| import static org.junit.gen5.api.Assertions.assertEquals; | |
| public class HelloWorldTest { | |
| @Test | |
| public void | |
| first_scenario() { | |
| Hello hello = new Hello(); | |
| String actualResult = hello.say(); | |
| assertEquals("Hello", actualResult); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.junit.gen5.api.Test; | |
| import org.junit.gen5.junit4.runner.JUnit5; | |
| import org.junit.runner.RunWith; | |
| import static org.junit.gen5.api.Assertions.assertEquals; | |
| @RunWith(JUnit5.class) | |
| public class HelloWorldTestRunWithJUnit5 { | |
| @Test | |
| public void | |
| first_scenario() { | |
| Hello hello = new Hello(); | |
| String actualResult = hello.say(); | |
| assertEquals("Hello", actualResult); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>demo.junit5</groupId> | |
| <artifactId>demo.junit5</artifactId> | |
| <version>1.0-SNAPSHOT</version> | |
| <properties> | |
| <java-version>1.8</java-version> | |
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
| <junit5-version>5.0.0-ALPHA</junit5-version> | |
| </properties> | |
| <build> | |
| <plugins> | |
| <plugin> | |
| <artifactId>maven-compiler-plugin</artifactId> | |
| <version>3.1</version> | |
| <configuration> | |
| <source>${java-version}</source> | |
| <target>${java-version}</target> | |
| </configuration> | |
| </plugin> | |
| </plugins> | |
| </build> | |
| <dependencies> | |
| <dependency> | |
| <groupId>org.junit</groupId> | |
| <artifactId>junit5-api</artifactId> | |
| <version>${junit5-version}</version> | |
| <scope>test</scope> | |
| </dependency> | |
| <dependency> | |
| <groupId>org.junit</groupId> | |
| <artifactId>junit5-engine</artifactId> | |
| <version>${junit5-version}</version> | |
| <scope>test</scope> | |
| </dependency> | |
| <dependency> | |
| <groupId>org.junit</groupId> | |
| <artifactId>junit4-runner</artifactId> | |
| <version>${junit5-version}</version> | |
| <scope>test</scope> | |
| </dependency> | |
| </dependencies> | |
| </project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment