Package org.sonar.api.batch.sensor

Examples of org.sonar.api.batch.sensor.SensorContext


  public void testRule() {
    DefaultFileSystem fs = new DefaultFileSystem();
    DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.xoo").setLanguage(Xoo.KEY).setLines(10);
    fs.add(inputFile);

    SensorContext context = mock(SensorContext.class);
    final SensorStorage sensorStorage = mock(SensorStorage.class);
    when(context.settings()).thenReturn(new Settings());
    when(context.fileSystem()).thenReturn(fs);
    when(context.newIssue()).thenAnswer(new Answer<Issue>() {
      @Override
      public Issue answer(InvocationOnMock invocation) throws Throwable {
        return new DefaultIssue(sensorStorage);
      }
    });
View Full Code Here


  public void testForceSeverity() {
    DefaultFileSystem fs = new DefaultFileSystem();
    DefaultInputFile inputFile = new DefaultInputFile("foo", "src/Foo.xoo").setLanguage(Xoo.KEY).setLines(10);
    fs.add(inputFile);

    SensorContext context = mock(SensorContext.class);
    final SensorStorage sensorStorage = mock(SensorStorage.class);
    Settings settings = new Settings();
    settings.setProperty(OneIssuePerLineSensor.FORCE_SEVERITY_PROPERTY, "MINOR");
    when(context.settings()).thenReturn(settings);
    when(context.fileSystem()).thenReturn(fs);
    when(context.newIssue()).thenAnswer(new Answer<Issue>() {
      @Override
      public Issue answer(InvocationOnMock invocation) throws Throwable {
        return new DefaultIssue(sensorStorage);
      }
    });
View Full Code Here

TOP

Related Classes of org.sonar.api.batch.sensor.SensorContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.