Class InternalIssueVerifier
- java.lang.Object
-
- org.sonarsource.analyzer.commons.checks.verifier.internal.InternalIssueVerifier
-
- All Implemented Interfaces:
MultiFileVerifier,SingleFileVerifier
public class InternalIssueVerifier extends Object implements MultiFileVerifier, SingleFileVerifier
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.sonarsource.analyzer.commons.checks.verifier.MultiFileVerifier
MultiFileVerifier.Issue, MultiFileVerifier.IssueBuilder
-
Nested classes/interfaces inherited from interface org.sonarsource.analyzer.commons.checks.verifier.SingleFileVerifier
SingleFileVerifier.Issue, SingleFileVerifier.IssueBuilder
-
-
Constructor Summary
Constructors Constructor Description InternalIssueVerifier(Path mainSourceFilePath, Charset encoding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InternalIssueVerifieraddComment(int line, int column, String content, int prefixLength, int suffixLength)Should be called for all comment of the analyzed source file.InternalIssueVerifieraddComment(Path path, int line, int column, String content, int prefixLength, int suffixLength)Should be called for all comment of the analyzed source file.voidassertNoIssues()Run the comparison and expect to find no issue.voidassertOneOrMoreIssues()Run the comparison and expect to find at least one issue.org.sonarsource.analyzer.commons.checks.verifier.internal.InternalIssuereportIssue(String message)Each issue raised by a rule should be reported using this method.org.sonarsource.analyzer.commons.checks.verifier.internal.InternalIssuereportIssue(Path path, String message)Each issue raised by a rule should be reported using this method.
-
-
-
Method Detail
-
addComment
public InternalIssueVerifier addComment(Path path, int line, int column, String content, int prefixLength, int suffixLength)
Description copied from interface:MultiFileVerifierShould be called for all comment of the analyzed source file. Example:void visitComment(CommentToken token) { verifier.addComment(token.path(), token.line(), token.column(), token.text(), COMMENT_PREFIX_LENGTH, COMMENT_SUFFIX_LENGTH); }- Specified by:
addCommentin interfaceMultiFileVerifier- Parameters:
path- path of the source codeline- start at 1, beginning of the commentcolumn- start at 1, beginning of the comment prefixcontent- content of the comment with prefix and suffixprefixLength- for example, if the prefix is '//' then the length is 2suffixLength- for example, if the suffix is '-->' then the length is 3
-
addComment
public InternalIssueVerifier addComment(int line, int column, String content, int prefixLength, int suffixLength)
Description copied from interface:SingleFileVerifierShould be called for all comment of the analyzed source file. Example:void visitComment(CommentToken token) { verifier.addComment(token.line(), token.column(), token.text(), COMMENT_PREFIX_LENGTH, COMMENT_SUFFIX_LENGTH); }- Specified by:
addCommentin interfaceSingleFileVerifier- Parameters:
line- start at 1, beginning of the commentcolumn- start at 1, beginning of the comment prefixcontent- content of the comment with prefix and suffixprefixLength- for example, if the prefix is '//' then the length is 2suffixLength- for example, if the suffix is '-->' then the length is 3
-
reportIssue
public org.sonarsource.analyzer.commons.checks.verifier.internal.InternalIssue reportIssue(Path path, String message)
Description copied from interface:MultiFileVerifierEach issue raised by a rule should be reported using this method.verifier.reportIssue(path, "Issue on file").onFile(); verifier.reportIssue(path, "Issue on line").onLine(line); verifier.reportIssue(path, "Issue on range with a secondary location").onRange(line, column, endLine, endColumn) .addSecondary(secondary.line, secondary.column, secondary.endLine, secondary.endColumn, "Secondary message");- Specified by:
reportIssuein interfaceMultiFileVerifier- Parameters:
path- path of the source code file that has the issuemessage- issue message
-
reportIssue
public org.sonarsource.analyzer.commons.checks.verifier.internal.InternalIssue reportIssue(String message)
Description copied from interface:SingleFileVerifierEach issue raised by a rule should be reported using this method.verifier.reportIssue("Issue on file").onFile(); verifier.reportIssue("Issue on line").onLine(line); verifier.reportIssue("Issue on range with a secondary location").onRange(line, column, endLine, endColumn) .addSecondary(secondary.line, secondary.column, secondary.endLine, secondary.endColumn, "Secondary message");- Specified by:
reportIssuein interfaceSingleFileVerifier- Parameters:
message- issue message
-
assertOneOrMoreIssues
public void assertOneOrMoreIssues()
Description copied from interface:MultiFileVerifierRun the comparison and expect to find at least one issue.- Specified by:
assertOneOrMoreIssuesin interfaceMultiFileVerifier- Specified by:
assertOneOrMoreIssuesin interfaceSingleFileVerifier
-
assertNoIssues
public void assertNoIssues()
Description copied from interface:MultiFileVerifierRun the comparison and expect to find no issue.- Specified by:
assertNoIssuesin interfaceMultiFileVerifier- Specified by:
assertNoIssuesin interfaceSingleFileVerifier
-
-