@@ -22,16 +22,12 @@ It introduced a lot of interesting, fast ways to create tests.
2222Be it Test-Factories, Test-Extensions (that only have to be implemented once), Lambda-Support etc.
2323It pushes the D.R.Y. principle a lot!
2424
25- To understand this guide you should know the basics of testing and JUnit (4), but otherwise you wouldn't be here I guess.
25+ To follow this guide you should know the basics of testing and JUnit (4), but otherwise you wouldn't be here I guess.
2626You can also check out the best-practice-part included in this repository.
2727It was created by request of a colleague:
2828link:src/test/java/com/drandarov/bestPractice/JUnit_BestPractice.java[**Checkout JUnit best-practices included in this repository**]
2929
30- JUnit 5 also supports running parallel to JUnit 4 if that's something you need.
31-
3230Some headers related to code will have a code-link behind their name directing to the corresponding class in the GitHub-Repository.
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**]
3531
3632=== Setup
3733For an IDE I recommend *IntelliJ IDEA 2016.2(+)* right now since it brings native support for JUnit 5.
@@ -152,7 +148,7 @@ void assumptionsTest() {
152148
153149== New features: Basics link:src/test/java/com/drandarov/junit5/JUnit5_01_NewFeaturesBasics.java[(code)]
154150
155- ### General
151+ === General
156152Here I want to introduce some basics for the new features available in the new version.
157153There is a new pretty annotation called `@DisplayName` which is supposed to improve the readability of test reports, so you don't need 40-character test-names to make clear what the test is about at a glance.
158154
@@ -187,7 +183,7 @@ class groupedTests {
187183
188184image::02_nestedTests_result.png[]
189185
190- ### Assertions and Lambda-Support
186+ === Assertions and Lambda-Support
191187Now for the probably most known and anticipated feature in JUnit 5: Lambda-Support...
192188JUnit 5 `Assertions` and `Assumptions` classes and its methods now provide Lambda support.
193189This is achieved by providing methods with functional interfaces as parameters.
@@ -264,7 +260,7 @@ void expectThrowsTest() {
264260}
265261```
266262
267- ### Parameter Resolver
263+ === Parameter Resolver
268264
269265The biggest new feature in JUnit 5 is the new Extension-API.
270266A part of it is the `ParameterResolver`-Interface which is an extension of the `Extension`-Interface itself.
@@ -299,7 +295,7 @@ void parameterTest(TestInfo testInfo, TestReporter testReporter) {
299295
300296== New features: Advanced link:src/test/java/com/drandarov/junit5/JUnit5_02_NewFeaturesAdvanced.java[(code)]
301297
302- ### Test-Parameters
298+ === Test-Parameters
303299Building upon the `ParameterResolver` paragraph of the last chapter let's look at implementing your own `ParameterResolver`.
304300You can also see the first visual sign of the Extension-API in the form of the `@ExtendWith`-Annotation. The final result is:
305301
@@ -384,7 +380,7 @@ public class ParameterIndex_ParameterResolver implements ParameterResolver {
384380}
385381```
386382
387- ### Test-Factories
383+ === Test-Factories
388384Another nice feature are the new Test-Factories.
389385These are annotated with `@TestFactory` instead of `@Test`.
390386Their return type is some kind of collection of ``DynamicTest``s.
@@ -415,7 +411,7 @@ Stream<DynamicTest> testStreamFactoryTest() {
415411
416412image::03_testFactory_result.png[]
417413
418- ### Test-Extensions
414+ === Test-Extensions
419415Here I will show you an `Extension` that is not based on the `ParameterResolver` but instead implements the `TestExecutionCondition`.
420416The same thing that powers the `@Disabled` annotation.
421417If we want to customize it we need out own implementation.
@@ -465,9 +461,9 @@ void disabledOnMondayTest() {}
465461Again: This could without problem be placed on class-level.
466462
467463
468- == Advanced Test-Samples link:src/test/java/com/drandarov/junit5/JUnit5_00_GeneralChanges .java[(code)]
464+ == Advanced Test-Samples link:src/test/java/com/drandarov/junit5/JUnit5_03_AdvancedTestSamples .java[(code)]
469465
470- ### Extended disabled weekdays
466+ === Extended disabled weekdays
471467Let's extend that `@DisabledOnMonday` annotation a bit.
472468What if you want to choose the weekday?
473469Creating 7 annotations is kind of overkill.
@@ -541,7 +537,7 @@ public class DisabledOnWeekday implements TestExecutionCondition {
541537}
542538```
543539
544- ### Extend Test-Annotation
540+ === Extend Test-Annotation
545541So what if you want to save some that space occupied by all those annotations.
546542Let's make it all-in-one for this example:
547543
@@ -598,7 +594,7 @@ One extension resolves the `Pane` from the fxml path and the other one just prin
598594This is rather a showcase of an `@Test`-Extension and including utilizing the extension features of JUnit 5.
599595If you want to see code nevertheless look into the repository.
600596
601- ### Benchmarking Example
597+ === Benchmarking Example
602598
603599As for the last example right now I will showcase some benchmarking possibilities and it isn't even that complicated.
604600There are several extensions that can be used for that.
@@ -699,44 +695,44 @@ Of course I could have also included `@Benchmarked` in a separate `@BenchmarkedT
699695
700696== Changes from M4-RC2 link:src/test/java/com/drandarov/junit5/xxxxxxxxxxx.java[(code)]
701697
702- ### TODO
698+ === TODO
703699.
704700
705701== Closing words
706702
707- ### Contribution
703+ === Contribution
708704Feel free to express critique and contribute to the [repository](https://github.com/dmitrij-drandarov/JUnit5-Quick-Start-Guide-and-Advanced) :)
709705
710- ### Usage
706+ === Usage
711707You can use this repository in any way you want.
712708May it be for workshops or presentations. Just give credits. ;)
713709
714- ### Schedule
715- - [ ] 5.0 GA (General Availability Release) Update - Due by August 24, 2017
710+ === Schedule
711+ * [ ] 5.0 GA (General Availability Release) Update - Due by August 24, 2017
716712
717- ### Further Reference
718- [Official JUnit 5 User Guide](http://junit.org/junit5/docs/current/user-guide)
719- [JUnit 5 GitHub](https://github.com/junit-team/junit5)
720- [JUnit 5 Milestone plan](https://github.com/junit-team/junit5/milestones/)
713+ === Further Reference
714+ [%hardbreaks]
715+ * http://junit.org/junit5/docs/current/user-guide[Official JUnit 5 User Guide]
716+ * https://github.com/junit-team/junit5[JUnit 5 GitHub]
717+ * https://github.com/junit-team/junit5/milestones/[JUnit 5 Milestone plan]
721718
722719== Repository Timeline
723720
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
721+ * [ ] Update for M4-RC2 - XX Aug 2017
722+ * [x] Fix userInterfaceTest - 01 Aug 2017
723+ * [x] Create wiki article with githup-pages-content - 04 Mar 2017
724+ * [x] Convert code fragments from images to text - 04 Mar 2017
725+ * [x] Incorporate JUnit Best-Practice on request - 15 Feb 2017
726+ * [x] Change name - 05 Aug 2016
727+ * [x] Finish Stream TODOs - 05 Aug 2016
728+ * [x] Proper Presentation - 04 Aug 2016
729+ * [x] Add reference - 03 Aug 2016
730+ * [x] Add expectThrows() - 03 Aug 2016
731+ * [x] Add @Nested - 03 Aug 2016
732+ * [x] Adjust packages and classes for presentation - 01 Aug 2016
733+ * [x] Extend Test-Extensions - 29 Jul 2016
734+ * [x] Test-Extensions (o\j\j\api\extension) - 28 Jul 2016
735+ * [x] @TestFactory + DynamicTests - 26 Jul 2016
736+ * [x] Reorder packages and classes - 26 Jul 2016
737+ * [x] Links to Java-Files - 24 Jul 2016
738+ * [x] Dependency Copy-Paste Resource - 24 Jul 2016
0 commit comments