Search in sources :

Example 1 with JsonClientImpl

use of net.nemerosa.ontrack.client.JsonClientImpl in project ontrack by nemerosa.

the class DefaultJenkinsClientTest method before.

@Before
public void before() {
    OTHttpClient httpClient = mock(OTHttpClient.class);
    when(httpClient.getUrl(anyString(), any(String[].class))).thenAnswer(invocation -> {
        String path = (String) invocation.getArguments()[0];
        String parameters = (String) invocation.getArguments()[1];
        return String.format("http://jenkins/%s", String.format(path, parameters));
    });
    JsonClient jsonClient = new JsonClientImpl(httpClient);
    jenkinsClient = new DefaultJenkinsClient(jsonClient);
}
Also used : JsonClient(net.nemerosa.ontrack.client.JsonClient) JsonClientImpl(net.nemerosa.ontrack.client.JsonClientImpl) OTHttpClient(net.nemerosa.ontrack.client.OTHttpClient) Matchers.anyString(org.mockito.Matchers.anyString) Before(org.junit.Before)

Aggregations

JsonClient (net.nemerosa.ontrack.client.JsonClient)1 JsonClientImpl (net.nemerosa.ontrack.client.JsonClientImpl)1 OTHttpClient (net.nemerosa.ontrack.client.OTHttpClient)1 Before (org.junit.Before)1 Matchers.anyString (org.mockito.Matchers.anyString)1