@Beta public class SensorContextTester extends Object implements SensorContext
Sensor
.
Usage: call create(File)
to create an "in memory" implementation of SensorContext
then
pass it to your Sensor
. You can then query elements provided by your sensor using methods allIssues()
, ...Modifier and Type | Class and Description |
---|---|
static class |
SensorContextTester.MockAnalysisMode |
Modifier and Type | Method and Description |
---|---|
ActiveRules |
activeRules()
Get list of active rules.
|
Collection<Issue> |
allIssues() |
SensorContextTester.MockAnalysisMode |
analysisMode()
Get analysis mode.
|
Integer |
conditions(String fileKey,
CoverageType type,
int line) |
Integer |
coveredConditions(String fileKey,
CoverageType type,
int line) |
static SensorContextTester |
create(File moduleBaseDir) |
Collection<Duplication> |
duplications() |
DefaultFileSystem |
fileSystem()
Get filesystem of the current module.
|
List<TypeOfText> |
highlightingTypeAt(String componentKey,
int line,
int lineOffset) |
Integer |
lineHits(String fileKey,
CoverageType type,
int line) |
<G extends Serializable> |
measure(String componetKey,
Metric<G> metric) |
<G extends Serializable> |
measure(String componentKey,
String metricKey) |
Collection<Measure> |
measures(String componentKey) |
NewCoverage |
newCoverage()
Builder to define coverage in a file.
|
NewDuplication |
newDuplication()
Builder to manually register duplication in a file.
|
NewHighlighting |
newHighlighting()
Builder to define highlighting of a file.
|
NewIssue |
newIssue()
Fluent builder to create a new
Issue . |
<G extends Serializable> |
newMeasure()
Fluent builder to create a new
Measure . |
void |
setActiveRules(ActiveRules activeRules) |
void |
setFileSystem(DefaultFileSystem fs) |
void |
setSettings(Settings settings) |
Settings |
settings()
Get settings of the current module.
|
public static SensorContextTester create(File moduleBaseDir)
public Settings settings()
SensorContext
settings
in interface SensorContext
public void setSettings(Settings settings)
public DefaultFileSystem fileSystem()
SensorContext
fileSystem
in interface SensorContext
public void setFileSystem(DefaultFileSystem fs)
public ActiveRules activeRules()
SensorContext
activeRules
in interface SensorContext
public void setActiveRules(ActiveRules activeRules)
public SensorContextTester.MockAnalysisMode analysisMode()
SensorContext
analysisMode
in interface SensorContext
public <G extends Serializable> NewMeasure<G> newMeasure()
SensorContext
Measure
. Don't forget to call NewMeasure.save()
once all parameters are provided.newMeasure
in interface SensorContext
public Collection<Measure> measures(String componentKey)
public <G extends Serializable> Measure<G> measure(String componetKey, Metric<G> metric)
public <G extends Serializable> Measure<G> measure(String componentKey, String metricKey)
public NewIssue newIssue()
SensorContext
Issue
. Don't forget to call NewIssue.save()
once all parameters are provided.newIssue
in interface SensorContext
public Collection<Issue> allIssues()
@CheckForNull public Integer lineHits(String fileKey, CoverageType type, int line)
@CheckForNull public Integer conditions(String fileKey, CoverageType type, int line)
@CheckForNull public Integer coveredConditions(String fileKey, CoverageType type, int line)
public NewHighlighting newHighlighting()
SensorContext
NewHighlighting.save()
once all elements are provided.newHighlighting
in interface SensorContext
public NewCoverage newCoverage()
SensorContext
NewDuplication.save()
.newCoverage
in interface SensorContext
public List<TypeOfText> highlightingTypeAt(String componentKey, int line, int lineOffset)
public NewDuplication newDuplication()
SensorContext
CpdMapping
extension point.
Don't forget to call NewDuplication.save()
.newDuplication
in interface SensorContext
public Collection<Duplication> duplications()
Copyright © 2009–2015 SonarSource. All rights reserved.