Skip to content

Commit 947291e

Browse files
committed
Polish URI TestSource documentation for dynamic tests
See #1903
1 parent e6c9ba5 commit 947291e

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

documentation/src/docs/asciidoc/user-guide/writing-tests.adoc

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,22 +1581,30 @@ include::{testDir}/example/DynamicTestsDemo.java[tags=user_guide]
15811581
The JUnit Platform provides `TestSource`, a representation of the source of a test or
15821582
container used to navigate to its location by IDEs and build tools.
15831583

1584-
Test sources for dynamic tests can be constructed from URIs.
1584+
The `TestSource` for a dynamic test or dynamic container can be constructed from a
1585+
`java.net.URI` which can be supplied via the `DynamicTest.dynamicTest(String, URI,
1586+
Executable)` or `DynamicContainer.dynamicContainer(String, URI, Stream)` factory method,
1587+
respectively. The `URI` will be converted to one of the following `TestSource`
1588+
implementations.
15851589

15861590
`ClasspathResourceSource` ::
1587-
Use the `classpath` scheme -- for example, `classpath:/test/foo.xml?line=20,column=2`.
1591+
If the `URI` contains the `classpath` scheme -- for example,
1592+
`classpath:/test/foo.xml?line=20,column=2`.
15881593

15891594
`DirectorySource` ::
1590-
Use file system path.
1595+
If the `URI` represents a directory present in the file system.
15911596

15921597
`FileSource` ::
1593-
Use file system path.
1598+
If the `URI` represents a file present in the file system.
15941599

15951600
`MethodSource` ::
1596-
Use the `method` scheme and the fully qualified method name (FQMN) -- for example,
1597-
`method:org.junit.Foo#bar(java.lang.String, java.lang.String[])`. Please refer to the
1598-
Javadoc for `DiscoverySelectors.selectMethod(String)` for the supported formats for a
1599-
FQMN.
1601+
If the `URI` contains the `method` scheme and the fully qualified method name (FQMN) --
1602+
for example, `method:org.junit.Foo#bar(java.lang.String, java.lang.String[])`. Please
1603+
refer to the Javadoc for `DiscoverySelectors.selectMethod(String)` for the supported
1604+
formats for a FQMN.
1605+
1606+
`UriSource` ::
1607+
If none of the above `TestSource` implementations are applicable.
16001608

16011609

16021610
[[writing-tests-declarative-timeouts]]

0 commit comments

Comments
 (0)