Skip to content

Commit

Permalink
Improve formatting in User Guide
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed Aug 10, 2024
1 parent 448f650 commit a0df73c
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions documentation/src/test/java21/example/DynamicTestsNamedDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ public class DynamicTestsNamedDemo {
@TestFactory
Stream<DynamicTest> dynamicTestsFromStreamFactoryMethodWithNames() {
// Stream of palindromes to check
var inputStream = Stream.of(named("racecar is a palindrome", "racecar"),
named("radar is also a palindrome", "radar"), named("mom also seems to be a palindrome", "mom"),
named("dad is yet another palindrome", "dad"));
// end::user_guide[]
// @formatter:off
// tag::user_guide[]
var inputStream = Stream.of(
named("racecar is a palindrome", "racecar"),
named("radar is also a palindrome", "radar"),
named("mom also seems to be a palindrome", "mom"),
named("dad is yet another palindrome", "dad")
);
// end::user_guide[]
// @formatter:on
// tag::user_guide[]

// Returns a stream of dynamic tests.
return DynamicTest.stream(inputStream, text -> assertTrue(isPalindrome(text)));
Expand All @@ -38,7 +47,14 @@ Stream<DynamicTest> dynamicTestsFromStreamFactoryMethodWithNames() {
@TestFactory
Stream<DynamicTest> dynamicTestsFromStreamFactoryMethodWithNamedExecutables() {
// Stream of palindromes to check
var inputStream = Stream.of("racecar", "radar", "mom", "dad").map(PalindromeNamedExecutable::new);
// end::user_guide[]
// @formatter:off
// tag::user_guide[]
var inputStream = Stream.of("racecar", "radar", "mom", "dad")
.map(PalindromeNamedExecutable::new);
// end::user_guide[]
// @formatter:on
// tag::user_guide[]

// Returns a stream of dynamic tests based on NamedExecutables.
return DynamicTest.stream(inputStream);
Expand Down

0 comments on commit a0df73c

Please sign in to comment.