Class FilePosition
java.lang.Object
org.junit.platform.engine.discovery.FilePosition
- All Implemented Interfaces:
Serializable
@API(status=STABLE,
since="1.7")
public final class FilePosition
extends Object
implements Serializable
- Since:
- 1.7
- See Also:
- Implementation Note:
- This class is a copy of
FilePosition, which is not accessible from this package. The decision to duplicate it is motivated by an eventual divergence between the two classes in the future.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic FilePositionfrom(int line) Create a newFilePositionusing the suppliedlinenumber and an undefined column number.static FilePositionfrom(int line, int column) Create a newFilePositionusing the suppliedlineandcolumnnumbers.static Optional<FilePosition> Create an optionalFilePositionby parsing the suppliedquerystring.Get the column number of thisFilePosition, if available.intgetLine()Get the line number of thisFilePosition.inthashCode()toString()
-
Method Details
-
from
Create a newFilePositionusing the suppliedlinenumber and an undefined column number.- Parameters:
line- the line number; must be greater than zero- Returns:
- a
FilePositionwith the given line number
-
from
Create a newFilePositionusing the suppliedlineandcolumnnumbers.- Parameters:
line- the line number; must be greater than zerocolumn- the column number; must be greater than zero- Returns:
- a
FilePositionwith the given line and column numbers
-
fromQuery
Create an optionalFilePositionby parsing the suppliedquerystring.Examples of valid
querystrings:"line=23""line=23&column=42"
- Parameters:
query- the query string; may benull- Returns:
- an
Optionalcontaining aFilePositionwith the parsed line and column numbers; nevernullbut potentially empty - Since:
- 1.3
- See Also:
-
getLine
public int getLine()Get the line number of thisFilePosition.- Returns:
- the line number
-
getColumn
-
equals
-
hashCode
-
toString
-