Search in sources :

Example 1 with SimpleGetRequest

use of org.sonar.api.server.ws.internal.SimpleGetRequest in project sonarqube by SonarSource.

the class QProfileRefTest method create_name_ref_from_ws_request.

@Test
public void create_name_ref_from_ws_request() {
    SimpleGetRequest req = new SimpleGetRequest();
    req.setParam("language", "js");
    req.setParam("profileName", "Sonar way");
    QProfileRef ref = QProfileRef.from(req);
    assertThat(ref.getLanguage()).isEqualTo("js");
    assertThat(ref.getName()).isEqualTo("Sonar way");
}
Also used : SimpleGetRequest(org.sonar.api.server.ws.internal.SimpleGetRequest) QProfileRef(org.sonar.server.qualityprofile.QProfileRef) Test(org.junit.Test)

Example 2 with SimpleGetRequest

use of org.sonar.api.server.ws.internal.SimpleGetRequest 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");
}
Also used : SimpleGetRequest(org.sonar.api.server.ws.internal.SimpleGetRequest) QProfileRef(org.sonar.server.qualityprofile.QProfileRef) Test(org.junit.Test)

Example 3 with SimpleGetRequest

use of org.sonar.api.server.ws.internal.SimpleGetRequest in project sonarqube by SonarSource.

the class QProfileRefTest method throw_IAE_if_request_does_not_define_ref.

@Test
public void throw_IAE_if_request_does_not_define_ref() {
    SimpleGetRequest req = new SimpleGetRequest();
    expectedException.expect(IllegalArgumentException.class);
    QProfileRef.from(req);
}
Also used : SimpleGetRequest(org.sonar.api.server.ws.internal.SimpleGetRequest) Test(org.junit.Test)

Example 4 with SimpleGetRequest

use of org.sonar.api.server.ws.internal.SimpleGetRequest in project sonarqube by SonarSource.

the class QProfileRefTest method create_name_ref_throws_IAE_if_language_is_missing.

@Test
public void create_name_ref_throws_IAE_if_language_is_missing() {
    SimpleGetRequest req = new SimpleGetRequest();
    req.setParam(QProfileRef.PARAM_PROFILE_KEY, "the key");
    req.setParam(QProfileRef.PARAM_PROFILE_NAME, "the name");
    expectedException.expect(IllegalArgumentException.class);
    QProfileRef.from(req);
}
Also used : SimpleGetRequest(org.sonar.api.server.ws.internal.SimpleGetRequest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 SimpleGetRequest (org.sonar.api.server.ws.internal.SimpleGetRequest)4 QProfileRef (org.sonar.server.qualityprofile.QProfileRef)2