Skip to content

Commit c5cdd3e

Browse files
Merge pull request #1 from tddbc/update-junit5-alpha
Update junit5 alpha
2 parents b969e96 + bed2e11 commit c5cdd3e

File tree

4 files changed

+61
-20
lines changed

4 files changed

+61
-20
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
TDDBC for Java with JUnit
2-
====================================
1+
# TDDBC for Java with JUnit5
32

43
これは、TDDBCのJava向けJUnitプロジェクトです。
54

@@ -53,7 +52,7 @@ $ gradle eclipse
5352
### テストの実行
5453

5554
```bash
56-
$ gradle test
55+
$ gradle -q junit5Test
5756
```
5857

5958
### gradleによるJava Projectの作成(gradle 1.9以降)
@@ -88,7 +87,7 @@ mvn eclipse:eclipse
8887

8988
### テストの実行
9089
```bash
91-
mvn test
90+
mvn -Dtest=* test
9291
```
9392

9493
## その他

build.gradle

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'java'
2+
apply plugin: 'org.junit.gen5.gradle'
23

34
/* ide */
45
apply {
@@ -12,17 +13,29 @@ project.ext {
1213
}
1314
version = '1.0-SNAPSHOT'
1415

15-
sourceCompatibility = targetCompatibility = 1.7
16+
sourceCompatibility = targetCompatibility = 1.8
1617

1718
tasks.withType(AbstractCompile) each { it.options.encoding = 'UTF-8' }
1819

20+
buildscript {
21+
repositories {
22+
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
23+
}
24+
dependencies {
25+
classpath 'org.junit:junit-gradle:5.0.0-SNAPSHOT'
26+
}
27+
}
28+
1929
repositories {
2030
mavenCentral()
2131
}
2232

2333
dependencies {
24-
testCompile 'junit:junit:4.11', { exclude module: 'hamcrest-core' }
25-
testCompile 'org.hamcrest:hamcrest-all:1.3'
34+
testCompile 'org.junit:junit5-api:5.0.0-ALPHA'
35+
}
36+
37+
junit5 {
38+
version '5.0.0-ALPHA'
2639
}
2740

2841
wrapper {

pom.xml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,59 @@
1212

1313
<properties>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
<java.version>1.8</java.version>
1516
</properties>
1617

18+
<pluginRepositories>
19+
<pluginRepository>
20+
<id>snapshots-repo</id>
21+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
22+
<releases>
23+
<enabled>false</enabled>
24+
</releases>
25+
<snapshots>
26+
<updatePolicy>always</updatePolicy>
27+
<enabled>true</enabled>
28+
</snapshots>
29+
</pluginRepository>
30+
</pluginRepositories>
31+
1732
<dependencies>
1833
<dependency>
19-
<groupId>junit</groupId>
20-
<artifactId>junit</artifactId>
21-
<version>4.11</version>
22-
<scope>test</scope>
23-
</dependency>
24-
<dependency>
25-
<groupId>org.hamcrest</groupId>
26-
<artifactId>hamcrest-all</artifactId>
27-
<version>1.3</version>
34+
<groupId>org.junit</groupId>
35+
<artifactId>junit5-api</artifactId>
36+
<version>5.0.0-ALPHA</version>
2837
<scope>test</scope>
2938
</dependency>
3039
</dependencies>
3140
<build>
3241
<plugins>
42+
<plugin>
43+
<artifactId>maven-compiler-plugin</artifactId>
44+
<version>3.1</version>
45+
<configuration>
46+
<source>${java.version}</source>
47+
<target>${java.version}</target>
48+
</configuration>
49+
</plugin>
3350
<plugin>
3451
<groupId>org.apache.maven.plugins</groupId>
3552
<artifactId>maven-eclipse-plugin</artifactId>
3653
<configuration>
3754
<downloadSources>true</downloadSources>
3855
</configuration>
3956
</plugin>
57+
<plugin>
58+
<artifactId>maven-surefire-plugin</artifactId>
59+
<version>2.19</version>
60+
<dependencies>
61+
<dependency>
62+
<groupId>org.junit</groupId>
63+
<artifactId>surefire-junit5</artifactId>
64+
<version>5.0.0-SNAPSHOT</version>
65+
</dependency>
66+
</dependencies>
67+
</plugin>
4068
</plugins>
4169
</build>
4270
</project>
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
package tddbc;
22

3-
import org.junit.Test;
3+
import org.junit.gen5.api.Test;
4+
import org.junit.gen5.api.DisplayName;
5+
import static org.junit.gen5.api.Assertions.*;
46

5-
import static org.hamcrest.CoreMatchers.is;
6-
import static org.junit.Assert.assertThat;
77

88
public class SampleTest {
99

1010
@Test
11+
@DisplayName("should return Hello TDD Boot Camp")
1112
public void _should_return_Hello_TDD_BootCamp() throws Exception {
1213
// Setup
1314
Sample sut = new Sample();
1415
// Exercise
1516
String actual = sut.say();
1617
// Verify
17-
assertThat(actual, is("Hello TDD BootCamp!"));
18+
assertEquals("Hello TDD BootCamp!", actual);
1819
}
1920

2021
}

0 commit comments

Comments
 (0)