</parameter>\r
</parameters>\r
</rule>\r
+ <rule>\r
+ <repositoryKey>checkstyle</repositoryKey>\r
+ <key>com.puppycrawl.tools.checkstyle.checks.naming.ClassTypeParameterName</key>\r
+ </rule>\r
+ <rule>\r
+ <repositoryKey>checkstyle</repositoryKey>\r
+ <key>com.puppycrawl.tools.checkstyle.checks.naming.MethodTypeParameterName</key>\r
+ </rule>\r
</rules>\r
-</profile>
\ No newline at end of file
+</profile>\r
</parameter>\r
</parameters>\r
</rule>\r
+ <rule>\r
+ <repositoryKey>checkstyle</repositoryKey>\r
+ <key>com.puppycrawl.tools.checkstyle.checks.naming.ClassTypeParameterName</key>\r
+ </rule>\r
+ <rule>\r
+ <repositoryKey>checkstyle</repositoryKey>\r
+ <key>com.puppycrawl.tools.checkstyle.checks.naming.MethodTypeParameterName</key>\r
+ </rule>\r
</rules>\r
-</profile>
\ No newline at end of file
+</profile>\r
<name><![CDATA[One Statement Per Line]]></name>
<configKey><![CDATA[Checker/TreeWalker/OneStatementPerLine]]></configKey>
</rule>
+
+ <rule key="com.puppycrawl.tools.checkstyle.checks.naming.ClassTypeParameterName">
+ <priority>MAJOR</priority>
+ <name><![CDATA[Class Type Parameter Name]]></name>
+ <configKey><![CDATA[Checker/TreeWalker/ClassTypeParameterName]]></configKey>
+
+ <param key="format" type="REGULAR_EXPRESSION">
+ <defaultValue>^[A-Z]$</defaultValue>
+ </param>
+ </rule>
+
+ <rule key="com.puppycrawl.tools.checkstyle.checks.naming.MethodTypeParameterName">
+ <priority>MAJOR</priority>
+ <name><![CDATA[Method Type Parameter Name]]></name>
+ <configKey><![CDATA[Checker/TreeWalker/MethodTypeParameterName]]></configKey>
+
+ <param key="format" type="REGULAR_EXPRESSION">
+ <defaultValue>^[A-Z]$</defaultValue>
+ </param>
+ </rule>
+
</rules>
import java.util.List;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.junit.Assert.assertThat;
+import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Mockito.mock;
public class CheckstyleRuleRepositoryTest {
ServerFileSystem fileSystem = mock(ServerFileSystem.class);
CheckstyleRuleRepository repository = new CheckstyleRuleRepository(fileSystem, new XMLRuleParser());
List<Rule> rules = repository.createRules();
- assertThat(rules.size(), greaterThan(100));
+ assertThat(rules.size()).isEqualTo(129);
}
+
}
import org.sonar.api.rules.RuleFinder;
import org.sonar.api.utils.ValidationMessages;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.number.OrderingComparisons.greaterThan;
-import static org.junit.Assert.assertThat;
+import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
ProfileDefinition sonarWay = new SonarWayProfile(new XMLProfileParser(newRuleFinder(), mock(MetricFinder.class)));
ValidationMessages validation = ValidationMessages.create();
RulesProfile profile = sonarWay.createProfile(validation);
- assertThat(profile.getActiveRulesByRepository(CheckstyleConstants.REPOSITORY_KEY).size(), greaterThan(1));
- assertThat(validation.hasErrors(), is(false));
+ assertThat(profile.getActiveRulesByRepository(CheckstyleConstants.REPOSITORY_KEY).size()).isEqualTo(32);
+ assertThat(validation.hasErrors()).isFalse();
}
private RuleFinder newRuleFinder() {
});
return ruleFinder;
}
+
}
*/
package org.sonar.plugins.checkstyle;
-import org.hamcrest.core.Is;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.sonar.api.rules.RuleFinder;
import org.sonar.api.utils.ValidationMessages;
-import static org.hamcrest.number.OrderingComparisons.greaterThan;
-import static org.junit.Assert.assertThat;
+import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class SunConventionsProfileTest {
+
@Test
public void shouldCreateProfile() {
ProfileDefinition definition = new SunConventionsProfile(new XMLProfileParser(newRuleFinder(), mock(MetricFinder.class)));
ValidationMessages validation = ValidationMessages.create();
RulesProfile sunProfile = definition.createProfile(validation);
- assertThat(sunProfile.getActiveRulesByRepository(CheckstyleConstants.REPOSITORY_KEY).size(), greaterThan(1));
- assertThat(validation.hasErrors(), Is.is(false));
+ assertThat(sunProfile.getActiveRulesByRepository(CheckstyleConstants.REPOSITORY_KEY).size()).isEqualTo(59);
+ assertThat(validation.hasErrors()).isFalse();
}
private RuleFinder newRuleFinder() {
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.param.maxProtected=maximum allowable number of protected methods.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.param.maxPublic=maximum allowable number of public methods.
rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck.name=One Statement Per Line
+rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.ClassTypeParameterName=Class Type Parameter Name
+rule.checkstyle.com.puppycrawl.tools.checkstyle.checks.naming.MethodTypeParameterName=Method Type Parameter Name
--- /dev/null
+Checks that class parameter names conform to the specified format
--- /dev/null
+Checks that method type parameter names conform to the specified format