@@ -85,7 +85,9 @@ public JavaFileObjectAssert source() {
8585 * @throws AssertionError if the diagnostic is null.
8686 */
8787 public AbstractLongAssert <?> position () {
88- return assertPosition (actual .getPosition (), "position" );
88+ isNotNull ();
89+
90+ return assertThat (actual .getPosition ()).describedAs ("position" );
8991 }
9092
9193 /**
@@ -97,7 +99,9 @@ public AbstractLongAssert<?> position() {
9799 * @throws AssertionError if the diagnostic is null.
98100 */
99101 public AbstractLongAssert <?> startPosition () {
100- return assertPosition (actual .getPosition (), "startPosition" );
102+ isNotNull ();
103+
104+ return assertThat (actual .getStartPosition ()).describedAs ("start position" );
101105 }
102106
103107 /**
@@ -109,7 +113,9 @@ public AbstractLongAssert<?> startPosition() {
109113 * @throws AssertionError if the diagnostic is null.
110114 */
111115 public AbstractLongAssert <?> endPosition () {
112- return assertPosition (actual .getEndPosition (), "endPosition" );
116+ isNotNull ();
117+
118+ return assertThat (actual .getEndPosition ()).describedAs ("end position" );
113119 }
114120
115121 /**
@@ -121,7 +127,9 @@ public AbstractLongAssert<?> endPosition() {
121127 * @throws AssertionError if the diagnostic is null.
122128 */
123129 public AbstractLongAssert <?> lineNumber () {
124- return assertPosition (actual .getLineNumber (), "lineNumber" );
130+ isNotNull ();
131+
132+ return assertThat (actual .getLineNumber ()).describedAs ("line number" );
125133 }
126134
127135 /**
@@ -133,7 +141,9 @@ public AbstractLongAssert<?> lineNumber() {
133141 * @throws AssertionError if the diagnostic is null.
134142 */
135143 public AbstractLongAssert <?> columnNumber () {
136- return assertPosition (actual .getColumnNumber (), "columnNumber" );
144+ isNotNull ();
145+
146+ return assertThat (actual .getColumnNumber ()).describedAs ("column number" );
137147 }
138148
139149 /**
@@ -145,7 +155,7 @@ public AbstractLongAssert<?> columnNumber() {
145155 public AbstractStringAssert <?> code () {
146156 isNotNull ();
147157
148- return assertThat (actual .getCode ());
158+ return assertThat (actual .getCode ()). describedAs ( "code" ) ;
149159 }
150160
151161 /**
@@ -225,9 +235,4 @@ public StackTraceAssert stackTrace() {
225235
226236 return new StackTraceAssert (actual .getStackTrace ());
227237 }
228-
229- private AbstractLongAssert <?> assertPosition (long position , String name ) {
230- isNotNull ();
231- return assertThat (position ).describedAs (name );
232- }
233238}
0 commit comments