use of net.nemerosa.ontrack.extension.artifactory.client.ArtifactoryClientImpl in project ontrack by nemerosa.
the class ArtifactoryClientImplTest method buildNumbersEmptyForBuildNotFound.
@Test
public void buildNumbersEmptyForBuildNotFound() {
JsonClient jsonClient = mock(JsonClient.class);
when(jsonClient.get("/api/build/%s", "PROJECT")).thenThrow(new ClientNotFoundException("Not found"));
ArtifactoryClientImpl client = new ArtifactoryClientImpl(jsonClient);
assertEquals(Collections.<String>emptyList(), client.getBuildNumbers("PROJECT"));
}
use of net.nemerosa.ontrack.extension.artifactory.client.ArtifactoryClientImpl in project ontrack by nemerosa.
the class ArtifactoryClientImplTest method buildNumbers.
@Test
public void buildNumbers() {
JsonClient jsonClient = mock(JsonClient.class);
when(jsonClient.get("/api/build/%s", "PROJECT")).thenReturn(object().with("buildsNumbers", array().with(object().with("uri", "/1").end()).with(object().with("uri", "/2").end()).end()).end());
ArtifactoryClientImpl client = new ArtifactoryClientImpl(jsonClient);
assertEquals(Arrays.asList("1", "2"), client.getBuildNumbers("PROJECT"));
}
Aggregations