public class TestDiagnosticUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
DIAGNOSTIC_FILE_PATTERN |
static java.lang.String |
DIAGNOSTIC_FILE_REGEX |
static java.util.regex.Pattern |
DIAGNOSTIC_FILE_WARNING_PATTERN |
static java.lang.String |
DIAGNOSTIC_FILE_WARNING_REGEX |
static java.util.regex.Pattern |
DIAGNOSTIC_IN_JAVA_PATTERN |
static java.lang.String |
DIAGNOSTIC_IN_JAVA_REGEX |
static java.util.regex.Pattern |
DIAGNOSTIC_PATTERN |
static java.lang.String |
DIAGNOSTIC_REGEX |
static java.util.regex.Pattern |
DIAGNOSTIC_WARNING_IN_JAVA_PATTERN |
static java.lang.String |
DIAGNOSTIC_WARNING_IN_JAVA_REGEX |
static java.util.regex.Pattern |
DIAGNOSTIC_WARNING_PATTERN |
static java.lang.String |
DIAGNOSTIC_WARNING_REGEX |
Constructor and Description |
---|
TestDiagnosticUtils() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.String> |
diagnosticsToString(java.util.List<TestDiagnostic> diagnostics)
Converts the given diagnostics to strings (as they would appear in a source file
individually)
|
static Pair<java.lang.String,java.lang.String> |
formatJavaxToolString(java.lang.String original,
boolean noMsgText) |
static TestDiagnosticLine |
fromDiagnosticFileLine(java.lang.String diagnosticLine)
Convert a line in a DiagnosticFile to a TestDiagnosticLine
|
static TestDiagnostic |
fromDiagnosticFileString(java.lang.String stringFromDiagnosticFile)
Instantiate the diagnostic based on a string that would appear in diagnostic files (i.e.
|
static TestDiagnostic |
fromJavaFileComment(java.lang.String filename,
long lineNumber,
java.lang.String stringFromjavaFile)
Instantiate the diagnostic from a string that would appear in a Java file, e.g.: "error:
(message)"
|
static TestDiagnosticLine |
fromJavaSourceLine(java.lang.String filename,
java.lang.String originalLine,
long lineNumber)
Convert a line in a JavaSource file to a (possibly empty) TestDiagnosticLine
|
static java.util.Set<TestDiagnostic> |
fromJavaxDiagnosticList(java.util.List<javax.tools.Diagnostic<? extends javax.tools.JavaFileObject>> javaxDiagnostics,
boolean noMsgText) |
static TestDiagnostic |
fromJavaxToolsDiagnostic(java.lang.String diagnosticString,
boolean noMsgText)
Instantiate a diagnostic using a diagnostic from the Java Compiler.
|
protected static TestDiagnostic |
fromPatternMatching(java.util.regex.Pattern diagnosticPattern,
java.util.regex.Pattern warningPattern,
java.lang.String filename,
java.lang.Long lineNumber,
java.lang.String diagnosticString) |
static void |
removeDiagnosticsOfKind(DiagnosticKind kind,
java.util.List<TestDiagnostic> expectedDiagnostics) |
public static final java.lang.String DIAGNOSTIC_IN_JAVA_REGEX
public static final java.util.regex.Pattern DIAGNOSTIC_IN_JAVA_PATTERN
public static final java.lang.String DIAGNOSTIC_WARNING_IN_JAVA_REGEX
public static final java.util.regex.Pattern DIAGNOSTIC_WARNING_IN_JAVA_PATTERN
public static final java.lang.String DIAGNOSTIC_REGEX
public static final java.util.regex.Pattern DIAGNOSTIC_PATTERN
public static final java.lang.String DIAGNOSTIC_WARNING_REGEX
public static final java.util.regex.Pattern DIAGNOSTIC_WARNING_PATTERN
public static final java.lang.String DIAGNOSTIC_FILE_REGEX
public static final java.util.regex.Pattern DIAGNOSTIC_FILE_PATTERN
public static final java.lang.String DIAGNOSTIC_FILE_WARNING_REGEX
public static final java.util.regex.Pattern DIAGNOSTIC_FILE_WARNING_PATTERN
public static TestDiagnostic fromDiagnosticFileString(java.lang.String stringFromDiagnosticFile)
stringFromDiagnosticFile
- a single diagnostic string to parsepublic static TestDiagnostic fromJavaFileComment(java.lang.String filename, long lineNumber, java.lang.String stringFromjavaFile)
lineNumber
- the lineNumber of the line immediately below the diagnostic comment in the
Java filestringFromjavaFile
- the string containing the diagnosticpublic static TestDiagnostic fromJavaxToolsDiagnostic(java.lang.String diagnosticString, boolean noMsgText)
protected static TestDiagnostic fromPatternMatching(java.util.regex.Pattern diagnosticPattern, java.util.regex.Pattern warningPattern, java.lang.String filename, java.lang.Long lineNumber, java.lang.String diagnosticString)
public static Pair<java.lang.String,java.lang.String> formatJavaxToolString(java.lang.String original, boolean noMsgText)
public static TestDiagnosticLine fromJavaSourceLine(java.lang.String filename, java.lang.String originalLine, long lineNumber)
public static TestDiagnosticLine fromDiagnosticFileLine(java.lang.String diagnosticLine)
public static java.util.Set<TestDiagnostic> fromJavaxDiagnosticList(java.util.List<javax.tools.Diagnostic<? extends javax.tools.JavaFileObject>> javaxDiagnostics, boolean noMsgText)
public static java.util.List<java.lang.String> diagnosticsToString(java.util.List<TestDiagnostic> diagnostics)
public static void removeDiagnosticsOfKind(DiagnosticKind kind, java.util.List<TestDiagnostic> expectedDiagnostics)