File tree Expand file tree Collapse file tree 5 files changed +48
-23
lines changed
Expand file tree Collapse file tree 5 files changed +48
-23
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ $ gradle eclipse
5252### テストの実行
5353
5454``` bash
55- $ gradle -q junit5Test
55+ $ gradle junitPlatformTest
5656```
5757
5858### gradleによるJava Projectの作成(gradle 1.9以降)
@@ -87,7 +87,7 @@ mvn eclipse:eclipse
8787
8888### テストの実行
8989``` bash
90- mvn -Dtest= * test
90+ mvn test
9191```
9292
9393## その他
Original file line number Diff line number Diff line change 11apply plugin : ' java'
2- apply plugin : ' org.junit.gen5 .gradle'
2+ apply plugin : ' org.junit.platform .gradle.plugin '
33
44/* ide */
55apply {
@@ -13,16 +13,19 @@ project.ext {
1313}
1414version = ' 1.0-SNAPSHOT'
1515
16+ ext. junitJupiterVersion = ' 5.0.0-M1'
17+ ext. log4JVersion = ' 2.5'
18+
1619sourceCompatibility = targetCompatibility = 1.8
1720
1821tasks. withType(AbstractCompile ) each { it. options. encoding = ' UTF-8' }
1922
2023buildscript {
2124 repositories {
22- maven { url ' https://oss.sonatype.org/content/repositories/snapshots ' }
25+ mavenCentral()
2326 }
2427 dependencies {
25- classpath ' org.junit:junit-gradle:5 .0.0-SNAPSHOT '
28+ classpath ' org.junit.platform :junit-platform- gradle-plugin:1 .0.0-M1 '
2629 }
2730}
2831
@@ -31,11 +34,21 @@ repositories {
3134}
3235
3336dependencies {
34- testCompile ' org.junit:junit5-api:5.0.0-ALPHA'
37+ testCompile " org.junit.jupiter:junit-jupiter-api:${ junitJupiterVersion} "
38+ testRuntime " org.junit.jupiter:junit-jupiter-engine:${ junitJupiterVersion} "
39+ testRuntime " org.apache.logging.log4j:log4j-core:${ log4JVersion} "
40+ testRuntime " org.apache.logging.log4j:log4j-jul:${ log4JVersion} "
3541}
3642
37- junit5 {
38- version ' 5.0.0-ALPHA'
43+ junitPlatform {
44+ logManager ' org.apache.logging.log4j.jul.LogManager'
45+ engines {
46+ include ' junit-jupiter'
47+ }
48+ tags {
49+ exclude ' slow'
50+ }
51+ includeClassNamePattern ' .*Test'
3952}
4053
4154wrapper {
Original file line number Diff line number Diff line change 1717
1818 <pluginRepositories >
1919 <pluginRepository >
20- <id >snapshots -repo</id >
21- <url >https://oss.sonatype.org/content/repositories/snapshots </url >
20+ <id >releases -repo</id >
21+ <url >https://oss.sonatype.org/content/repositories/releases </url >
2222 <releases >
23- <enabled >false </enabled >
23+ <enabled >true </enabled >
2424 </releases >
2525 <snapshots >
26- <updatePolicy >always</updatePolicy >
27- <enabled >true</enabled >
26+ <enabled >false</enabled >
2827 </snapshots >
2928 </pluginRepository >
3029 </pluginRepositories >
3130
3231 <dependencies >
3332 <dependency >
34- <groupId >org.junit</groupId >
35- <artifactId >junit5-api </artifactId >
36- <version >5.0.0-ALPHA </version >
33+ <groupId >org.junit.jupiter </groupId >
34+ <artifactId >junit-jupiter-engine </artifactId >
35+ <version >5.0.0-M1 </version >
3736 <scope >test</scope >
3837 </dependency >
3938 </dependencies >
6059 <version >2.19</version >
6160 <dependencies >
6261 <dependency >
63- <groupId >org.junit</groupId >
64- <artifactId >surefire-junit5 </artifactId >
65- <version >5 .0.0-SNAPSHOT </version >
62+ <groupId >org.junit.platform </groupId >
63+ <artifactId >junit-platform- surefire-provider </artifactId >
64+ <version >1 .0.0-M1 </version >
6665 </dependency >
6766 </dependencies >
6867 </plugin >
Original file line number Diff line number Diff line change 11package tddbc ;
22
3- import org .junit .gen5 .api .Test ;
4- import org .junit .gen5 .api .DisplayName ;
5- import static org .junit .gen5 .api .Assertions .*;
6-
3+ import org .junit .jupiter .api .Test ;
4+ import org .junit .jupiter .api .DisplayName ;
5+ import static org .junit .jupiter .api .Assertions .*;
76
87public class SampleTest {
98
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <Configuration status =" WARN" >
3+ <Appenders >
4+ <Console name =" Console" target =" SYSTEM_OUT" >
5+ <PatternLayout pattern =" %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
6+ </Console >
7+ </Appenders >
8+ <Loggers >
9+ <Logger name =" org.junit" level =" warn" />
10+ <Root level =" error" >
11+ <AppenderRef ref =" Console" />
12+ </Root >
13+ </Loggers >
14+ </Configuration >
You can’t perform that action at this time.
0 commit comments