use of org.sonarqube.ws.client.WsRequest in project sonarqube by SonarSource.
the class ScannerWsClientTest method fail_if_credentials_are_not_valid.
@Test
public void fail_if_credentials_are_not_valid() throws Exception {
expectedException.expect(MessageException.class);
expectedException.expectMessage("Not authorized. Please check the properties sonar.login and sonar.password.");
WsRequest request = newRequest();
WsResponse response = newResponse().setCode(401);
when(wsClient.wsConnector().call(request)).thenReturn(response);
new ScannerWsClient(wsClient, /* credentials are configured */
true, new GlobalMode(new GlobalProperties(Collections.emptyMap()))).call(request);
}
Aggregations