Class FileSource
java.lang.Object
org.junit.platform.engine.support.descriptor.FileSource
- All Implemented Interfaces:
Serializable, FileSystemSource, UriSource, TestSource
@API(status=STABLE,
since="1.0")
public final class FileSource
extends Object
implements FileSystemSource
File based
TestSource with an optional
position.- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic FileSourceCreate a newFileSourceusing the suppliedfile.static FileSourcefrom(File file, @Nullable FilePosition filePosition) getFile()Get the source file.Get theFilePosition, if available.getUri()inthashCode()toString()withPosition(@Nullable FilePosition filePosition) Returns aFileSourcebased on this instance but with the suppliedFilePosition.
-
Method Details
-
from
Create a newFileSourceusing the suppliedfile.- Parameters:
file- the source file; must not benull
-
from
- Parameters:
file- the source file; must not benullfilePosition- the position in the source file; may benull- See Also:
-
getUri
-
getFile
Get the source file.- Specified by:
getFilein interfaceFileSystemSource- Returns:
- the source file; never
null
-
getPosition
Get theFilePosition, if available. -
withPosition
@API(status=EXPERIMENTAL, since="1.14") public FileSource withPosition(@Nullable FilePosition filePosition) Returns aFileSourcebased on this instance but with the suppliedFilePosition.If the supplied
FilePositionequals the existing one, this method returnsthis. Otherwise, a new instance is created and returned.Calling this method rather than creating a new
FileSourceviafrom(File, FilePosition)avoids the overhead of redundant canonical path resolution.- Parameters:
filePosition- the position in the source file; may benull- Returns:
- a
FileSourcebased on this instance but with the suppliedFilePosition - Since:
- 1.14
-
equals
-
hashCode
-
toString
-