@Test
public void getLastVersion() throws UnknownHostException {

    final DbArtifact artifact = new DbArtifact();
    artifact.setGroupId("groupId");
    artifact.setArtifactId("artifactId");
    artifact.setVersion("version");
    final List<String> versions = new ArrayList<String>();
    versions.add("1");
    versions.add("2");
    when(repositoryHandler.getArtifact(artifact.getGavc())).thenReturn(artifact);
    when(repositoryHandler.getArtifactVersions(artifact)).thenReturn(versions);
    WebResource resource = client().resource("/" + ServerAPI.ARTIFACT_RESOURCE + "/" + artifact.getGavc() + ServerAPI.GET_LAST_VERSION);
    ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
    assertNotNull(response);
    assertEquals(HttpStatus.OK_200, response.getStatus());
    String lastVersion = response.getEntity(String.class);
    assertNotNull(lastVersion);
    assertEquals("2", lastVersion);
}