Skip to content

Commit 7209b0e

Browse files
committed
Migrate documentation to AsciiDoc and clean repository
1 parent 6dfedd1 commit 7209b0e

34 files changed

+49
-876
lines changed

README.adoc

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
= JUnit 5 Quick Start Guide and Advanced
2-
Dmitrij Drandarov <https://github.com>
3-
:images: img
2+
Dmitrij Drandarov <https://github.com/dmitrij-drandarov>
3+
:imagesdir: images
44
:sectnums:
5-
:toc: left
5+
:sectanchors:
6+
:sectlinks:
7+
:toc:
68

79
== Introduction
810

@@ -23,16 +25,15 @@ It pushes the D.R.Y. principle a lot!
2325
To understand this guide you should know the basics of testing and JUnit (4), but otherwise you wouldn't be here I guess.
2426
You can also check out the best-practice-part included in this repository.
2527
It was created by request of a colleague:
26-
[**Checkout JUnit best-practices included in this repository**
27-
](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced/blob/master/src/test/java/com/drandarov/bestPractice/JUnitX_XX_BestPractice.java)
28+
link:src/test/java/com/drandarov/bestPractice/JUnit_BestPractice.java[**Checkout JUnit best-practices included in this repository**]
2829

29-
Also JUnit 5 supports running parallel to JUnit 4 if that's something you need.
30+
JUnit 5 also supports running parallel to JUnit 4 if that's something you need.
3031

3132
Some headers related to code will have a code-link behind their name directing to the corresponding class in the GitHub-Repository.
32-
For the whole source code see my GitHub-Repository: [**dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced**
33-
](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced)
33+
For the whole source code see my GitHub-Repository:
34+
https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced[**dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced**]
3435

35-
=== Set-Up
36+
=== Setup
3637
For an IDE I recommend *IntelliJ IDEA 2016.2(+)* right now since it brings native support for JUnit 5.
3738
As for dependencies:
3839

@@ -42,31 +43,31 @@ As for dependencies:
4243
<dependency>
4344
<groupId>org.junit.jupiter</groupId>
4445
<artifactId>junit-jupiter-api</artifactId>
45-
<version>5.0.0-M4</version>
46+
<version>5.0.0-RC2/version>
4647
<scope>test</scope>
4748
</dependency>
4849
```
4950
If you need lagacy support for JUnit 4 or even JUnit 3, you can add the following dependency to your project
5051
```xml
5152
<dependency>
52-
<groupId>org.junit.platform</groupId>
53-
<artifactId>junit-platform-runner</artifactId>
54-
<version>1.0.0-M4</version>
53+
<groupId>org.junit.vintage</groupId>
54+
<artifactId>junit-vintage-engine</artifactId>
55+
<version>4.12.0-RC2</version>
5556
<scope>test</scope>
5657
</dependency>
5758
```
5859

5960
*Equivalents for Gradle*
6061

6162
```gradle
62-
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.0.0-M4'
63+
testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.0-RC2'
6364
```
6465
```gradle
65-
testCompile group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.0.0-M4'
66+
testCompile 'org.junit.vintage:junit-vintage-engine:4.12.0-RC2'
6667
```
6768

6869

69-
== General changes [(code)](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced/blob/master/src/test/java/com/drandarov/junit5/JUnit5_00_GeneralChanges.java)
70+
== General changes link:src/test/java/com/drandarov/junit5/JUnit5_00_GeneralChanges.java[(code)]
7071

7172

7273
=== Syntax
@@ -149,7 +150,7 @@ void assumptionsTest() {
149150
```
150151

151152

152-
== New features: Basics [(code)](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced/blob/master/src/test/java/com/drandarov/junit5/JUnit5_01_NewFeaturesBasics.java)
153+
== New features: Basics link:src/test/java/com/drandarov/junit5/JUnit5_01_NewFeaturesBasics.java[(code)]
153154

154155
### General
155156
Here I want to introduce some basics for the new features available in the new version.
@@ -166,8 +167,7 @@ There is a new pretty annotation called `@DisplayName` which is supposed to impr
166167
void displayNameTest() {}
167168
```
168169

169-
![img/04_displayname_result.png
170-
](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced/blob/master/img/04_displayname_result.png?raw=true)
170+
image::01_displayname_result.png[]
171171

172172
You can now also group tests with inner classes annotated with `@Nested`.
173173

@@ -185,8 +185,7 @@ class groupedTests {
185185
}
186186
```
187187

188-
![img/06_nestedTests_result.png
189-
](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced/blob/master/img/06_nestedTests_result.png?raw=true)
188+
image::02_nestedTests_result.png[]
190189

191190
### Assertions and Lambda-Support
192191
Now for the probably most known and anticipated feature in JUnit 5: Lambda-Support...
@@ -298,7 +297,7 @@ void parameterTest(TestInfo testInfo, TestReporter testReporter) {
298297
```
299298

300299

301-
== New features: Advanced [(code)](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced/blob/master/src/test/java/com/drandarov/junit5/JUnit5_02_NewFeaturesAdvanced.java)
300+
== New features: Advanced link:src/test/java/com/drandarov/junit5/JUnit5_02_NewFeaturesAdvanced.java[(code)]
302301

303302
### Test-Parameters
304303
Building upon the `ParameterResolver` paragraph of the last chapter let's look at implementing your own `ParameterResolver`.
@@ -388,7 +387,7 @@ public class ParameterIndex_ParameterResolver implements ParameterResolver {
388387
### Test-Factories
389388
Another nice feature are the new Test-Factories.
390389
These are annotated with `@TestFactory` instead of `@Test`.
391-
Their return type is some kind of collection of `DynamicTest`s.
390+
Their return type is some kind of collection of ``DynamicTest``s.
392391
The class `DynamicTest` provides several static methods to create those.
393392
You basically have to provide test data and based on it a display name as well as some kind of `Executable`.
394393
In my example you can see me using the `stream()`-method of said class.
@@ -414,7 +413,7 @@ Stream<DynamicTest> testStreamFactoryTest() {
414413
}
415414
```
416415

417-
![img/16_testFactory_result.png](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced/blob/master/img/16_testFactory_result.png?raw=true)
416+
image::03_testFactory_result.png[]
418417

419418
### Test-Extensions
420419
Here I will show you an `Extension` that is not based on the `ParameterResolver` but instead implements the `TestExecutionCondition`.
@@ -466,7 +465,7 @@ void disabledOnMondayTest() {}
466465
Again: This could without problem be placed on class-level.
467466

468467

469-
== Advanced Test-Samples [(code)](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced/blob/master/src/test/java/com/drandarov/junit5/JUnit5_00_GeneralChanges.java)
468+
== Advanced Test-Samples link:src/test/java/com/drandarov/junit5/JUnit5_00_GeneralChanges.java[(code)]
470469

471470
### Extended disabled weekdays
472471
Let's extend that `@DisabledOnMonday` annotation a bit.
@@ -634,7 +633,7 @@ void benchmarkedTest() {
634633

635634
The corresponding test-output:
636635

637-
![img/25_benchmarked_output.png](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced/blob/master/img/25_benchmarked_output.png?raw=true)
636+
image::04_benchmarked_output.png[]
638637

639638
The extension couldn't be simpler:
640639

@@ -698,12 +697,9 @@ public class BenchmarkExtension implements BeforeAllCallback, BeforeTestExecutio
698697

699698
Of course I could have also included `@Benchmarked` in a separate `@BenchmarkedTest` annotation that would have extended `@Test` as well saving that one line.
700699

701-
== Milestone 4 Changes [(code)](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced/blob/master/src/test/java/com/drandarov/junit5/JUnit5_04_Milestone_4.java)
700+
== Changes from M4-RC2 link:src/test/java/com/drandarov/junit5/xxxxxxxxxxx.java[(code)]
702701

703-
### Parameterized tests
704-
.
705-
706-
### Enhanced dynamic tests
702+
### TODO
707703
.
708704

709705
== Closing words
@@ -722,3 +718,25 @@ May it be for workshops or presentations. Just give credits. ;)
722718
[Official JUnit 5 User Guide](http://junit.org/junit5/docs/current/user-guide)
723719
[JUnit 5 GitHub](https://github.com/junit-team/junit5)
724720
[JUnit 5 Milestone plan](https://github.com/junit-team/junit5/milestones/)
721+
722+
== Repository Timeline
723+
724+
[%interactive]
725+
- [ ] Update for M4-RC2 - XX Aug 2017
726+
- [x] Fix userInterfaceTest - 01 Aug 2017
727+
- [x] Create wiki article with githup-pages-content - 04 Mar 2017
728+
- [x] Convert code fragments from images to text - 04 Mar 2017
729+
- [x] Incorporate JUnit Best-Practice on request - 15 Feb 2017
730+
- [x] Change name - 05 Aug 2016
731+
- [x] Finish Stream TODOs - 05 Aug 2016
732+
- [x] Proper Presentation - 04 Aug 2016
733+
- [x] Add reference - 03 Aug 2016
734+
- [x] Add expectThrows() - 03 Aug 2016
735+
- [x] Add @Nested - 03 Aug 2016
736+
- [x] Adjust packages and classes for presentation - 01 Aug 2016
737+
- [x] Extend Test-Extensions - 29 Jul 2016
738+
- [x] Test-Extensions (o\j\j\api\extension) - 28 Jul 2016
739+
- [x] @TestFactory + DynamicTests - 26 Jul 2016
740+
- [x] Reorder packages and classes - 26 Jul 2016
741+
- [x] Links to Java-Files - 24 Jul 2016
742+
- [x] Dependency Copy-Paste Resource - 24 Jul 2016

README_legacy.md

Lines changed: 0 additions & 42 deletions
This file was deleted.

_includes/head.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

css/asciidoc.css

Lines changed: 0 additions & 33 deletions
This file was deleted.

docs/_config.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)