use of org.sonar.plugins.web.rules.WebRulesDefinition in project sonar-web by SonarSource.
the class WebSensorTest method setUp.
@Before
public void setUp() throws Exception {
WebRulesDefinition rulesDefinition = new WebRulesDefinition();
RulesDefinition.Context context = new RulesDefinition.Context();
rulesDefinition.define(context);
RulesDefinition.Repository repository = context.repository(WebRulesDefinition.REPOSITORY_KEY);
List<NewActiveRule> ar = new ArrayList<>();
for (RulesDefinition.Rule rule : repository.rules()) {
ar.add(new ActiveRulesBuilder().create(RuleKey.of(WebRulesDefinition.REPOSITORY_KEY, rule.key())));
}
ActiveRules activeRules = new DefaultActiveRules(ar);
CheckFactory checkFactory = new CheckFactory(activeRules);
FileLinesContextFactory fileLinesContextFactory = mock(FileLinesContextFactory.class);
when(fileLinesContextFactory.createFor(Mockito.any(InputFile.class))).thenReturn(mock(FileLinesContext.class));
sensor = new WebSensor(new NoSonarFilter(), fileLinesContextFactory, checkFactory);
tester = SensorContextTester.create(TEST_DIR);
}
Aggregations