use of org.sonar.java.checks.naming.BadMethodNameCheck in project sonar-java by SonarSource.
the class GeneratedCodeFilterTest method test.
@Test
public void test() {
CommentRegularExpressionCheck commentRegularExpressionCheck = new CommentRegularExpressionCheck();
commentRegularExpressionCheck.regularExpression = ".*alpha.*";
FilterVerifier.verify("src/test/files/filters/GeneratedCodeFilter.java", new GeneratedCodeFilter(), // activated rules
commentRegularExpressionCheck, new BadClassNameCheck(), new BadMethodNameCheck(), new BadLocalVariableNameCheck());
}
use of org.sonar.java.checks.naming.BadMethodNameCheck in project sonar-java by SonarSource.
the class JavaSquidSensorTest method createSonarComponentsMock.
private static SonarComponents createSonarComponentsMock(SensorContextTester contextTester) {
Configuration settings = new MapSettings().asConfig();
DefaultFileSystem fs = contextTester.fileSystem();
JavaTestClasspath javaTestClasspath = new JavaTestClasspath(settings, fs);
JavaClasspath javaClasspath = new JavaClasspath(settings, fs);
FileLinesContext fileLinesContext = mock(FileLinesContext.class);
FileLinesContextFactory fileLinesContextFactory = mock(FileLinesContextFactory.class);
when(fileLinesContextFactory.createFor(any(InputFile.class))).thenReturn(fileLinesContext);
SonarComponents sonarComponents = spy(new SonarComponents(fileLinesContextFactory, fs, javaClasspath, javaTestClasspath, checkFactory));
sonarComponents.setSensorContext(contextTester);
BadMethodNameCheck check = new BadMethodNameCheck();
when(sonarComponents.checkClasses()).thenReturn(new JavaCheck[] { check });
return sonarComponents;
}
Aggregations