use of org.sonar.server.qualityprofile.QProfileRef in project sonarqube by SonarSource.
the class QProfileRefTest method getLanguage_throws_ISE_if_key_ref.
@Test
public void getLanguage_throws_ISE_if_key_ref() {
QProfileRef ref = QProfileRef.fromKey("foo");
expectedException.expect(IllegalStateException.class);
ref.getLanguage();
}
use of org.sonar.server.qualityprofile.QProfileRef in project sonarqube by SonarSource.
the class QProfileRefTest method test_equals_and_hashCode_of_name_ref.
@Test
public void test_equals_and_hashCode_of_name_ref() {
QProfileRef name1 = QProfileRef.fromName("js", "one");
QProfileRef name1bis = QProfileRef.fromName("js", "one");
QProfileRef name2 = QProfileRef.fromName("js", "two");
QProfileRef name1OtherLang = QProfileRef.fromName("java", "one");
QProfileRef key = QProfileRef.fromKey("one");
assertThat(name1.equals(name1)).isTrue();
assertThat(name1.equals(name1bis)).isTrue();
assertThat(name1.equals(name2)).isFalse();
assertThat(name1.equals(name1OtherLang)).isFalse();
assertThat(name1.equals(key)).isFalse();
assertThat(name1.hashCode()).isEqualTo(name1.hashCode());
assertThat(name1.hashCode()).isEqualTo(name1bis.hashCode());
}
use of org.sonar.server.qualityprofile.QProfileRef in project sonarqube by SonarSource.
the class QProfileRefTest method create_key_ref_from_ws_request.
@Test
public void create_key_ref_from_ws_request() {
SimpleGetRequest req = new SimpleGetRequest();
req.setParam("profileKey", "foo");
QProfileRef ref = QProfileRef.from(req);
assertThat(ref.getKey()).isEqualTo("foo");
}
use of org.sonar.server.qualityprofile.QProfileRef in project sonarqube by SonarSource.
the class QProfileRefTest method create_ref_by_name.
@Test
public void create_ref_by_name() {
QProfileRef ref = QProfileRef.fromName("js", "Sonar way");
assertThat(ref.hasKey()).isFalse();
assertThat(ref.getLanguage()).isEqualTo("js");
assertThat(ref.getName()).isEqualTo("Sonar way");
}
use of org.sonar.server.qualityprofile.QProfileRef in project sonarqube by SonarSource.
the class QProfileRefTest method getName_throws_ISE_if_key_ref.
@Test
public void getName_throws_ISE_if_key_ref() {
QProfileRef ref = QProfileRef.fromKey("foo");
expectedException.expect(IllegalStateException.class);
ref.getName();
}
Aggregations