Use AssertJ assertions in ParserTest.
@@ -11,11 +11,11 @@ import edu.hm.hafner.analysis.Issue;
import edu.hm.hafner.analysis.IssueBuilder;
import edu.hm.hafner.analysis.Priority;
import edu.hm.hafner.util.Ensure;
-import static org.junit.jupiter.api.Assertions.*;
+import static edu.hm.hafner.analysis.assertj.IssueAssert.*;
/**
* Base class for parser tests. Provides an assertion test for warnings.
- *
+ * <p>
* FIXME: close files
*/
public abstract class ParserTester {
@@ -33,12 +33,12 @@ public abstract class ParserTester {
* @param priority the expected priority
*/
protected void checkWarning(final Issue warning, final int lineNumber, final String message, final String fileName, final String category, final Priority priority) {
- assertEquals(priority, warning.getPriority(), "Wrong priority detected: ");
- assertEquals(category, warning.getCategory(), "Wrong category of warning detected: ");
- assertEquals(lineNumber, warning.getLineStart(), "Wrong line start detected: ");
- assertEquals(lineNumber, warning.getLineEnd(), "Wrong line end detected: ");
- assertEquals(message, warning.getMessage(), "Wrong message detected: ");
- assertEquals(fileName, warning.getFileName(), "Wrong filename detected: ");
+ assertThat(warning).hasPriority(priority);
+ assertThat(warning).hasCategory(category);
+ assertThat(warning).hasLineStart(lineNumber);
+ assertThat(warning).hasLineEnd(lineNumber);
+ assertThat(warning).hasMessage(message);
+ assertThat(warning).hasFileName(fileName);
}
/**
@@ -54,7 +54,7 @@ public abstract class ParserTester {
*/
protected void checkWarning(final Issue warning, final int lineNumber, final int column, final String message, final String fileName, final String category, final Priority priority) {
checkWarning(warning, lineNumber, message, fileName, category, priority);
- assertEquals(column, warning.getColumnStart(), "Wrong column start detected: ");
+ assertThat(warning).hasColumnStart(column);
}
/**
@@ -70,7 +70,7 @@ public abstract class ParserTester {
*/
protected void checkWarning(final Issue warning, final int lineNumber, final String message, final String fileName, final String type, final String category, final Priority priority) {
checkWarning(warning, lineNumber, message, fileName, category, priority);
- assertEquals(type, warning.getType(), "Wrong type of warning detected: ");
+ assertThat(warning).hasType(type);
}
/**
@@ -87,7 +87,7 @@ public abstract class ParserTester {
*/
protected void checkWarning(final Issue warning, final int lineNumber, final int column, final String message, final String fileName, final String type, final String category, final Priority priority) { // NOCHECKSTYLE
checkWarning(warning, lineNumber, column, message, fileName, category, priority);
- assertEquals(type, warning.getType(), "Wrong type of warning detected: ");
+ assertThat(warning).hasType(type);
}
/**
