use of org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.BuiltInQualityProfile in project sonarqube by SonarSource.
the class BuiltInQualityProfilesDefinitionTest method createDefaultProfile.
@Test
public void createDefaultProfile() {
Map<String, Map<String, BuiltInQualityProfile>> profiles = define(c -> {
c.createBuiltInQualityProfile("Foo", "xoo").setDefault(true).done();
});
assertThat(profiles).containsOnlyKeys("xoo");
assertThat(profiles.get("xoo")).containsOnlyKeys("Foo");
BuiltInQualityProfile profile = profiles.get("xoo").get("Foo");
assertThat(profile.name()).isEqualTo("Foo");
assertThat(profile.language()).isEqualTo("xoo");
assertThat(profile.isDefault()).isTrue();
}
use of org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.BuiltInQualityProfile in project sonarqube by SonarSource.
the class BuiltInQualityProfilesDefinitionTest method sanityEqualCheck.
@Test
public void sanityEqualCheck() {
Map<String, Map<String, BuiltInQualityProfile>> profiles = define(c -> {
NewBuiltInQualityProfile profile1 = c.createBuiltInQualityProfile("Foo1", "xoo");
NewBuiltInActiveRule rule = profile1.activateRule("repo", "rule");
profile1.done();
NewBuiltInQualityProfile profile2 = c.createBuiltInQualityProfile("Foo2", "xoo");
profile2.done();
NewBuiltInQualityProfile profile3 = c.createBuiltInQualityProfile("Foo1", "xoo2");
profile3.done();
assertThat(profile1).isNotNull();
assertThat(profile1).isNotEqualTo(profile2);
assertThat(profile1).isNotEqualTo(profile3);
assertThat(profile1.hashCode()).isNotEqualTo(profile2.hashCode());
assertThat(profile1.name()).isNotEqualTo("Foo");
assertThat(profile1.toString()).hasToString("NewBuiltInQualityProfile{name='Foo1', language='xoo', default='false'}");
assertThat(rule.toString()).hasToString("[repository=repo, key=rule]");
});
BuiltInQualityProfile profile1 = profiles.get("xoo").get("Foo1");
BuiltInQualityProfile profile2 = profiles.get("xoo").get("Foo2");
BuiltInQualityProfile profile3 = profiles.get("xoo2").get("Foo1");
assertThat(profile1).isNotNull().isNotEqualTo(profile2).isNotEqualTo(profile3);
assertThat(profile1.hashCode()).isNotEqualTo(profile2.hashCode());
assertThat(profile1.name()).isNotEqualTo("Foo");
assertThat(profile1.toString()).hasToString("BuiltInQualityProfile{name='Foo1', language='xoo', default='false'}");
assertThat(profile1.rule(RuleKey.of("repo", "rule")).toString()).hasToString("[repository=repo, key=rule]");
}
Aggregations