@Test
public void getAncestors() throws UnknownHostException {

    final List<DbModule> dependencies = new ArrayList<DbModule>();
    final DbModule module = new DbModule();
    module.setName("module");
    module.setVersion("version");
    final DbArtifact artifact = new DbArtifact();
    artifact.setGroupId("groupId");
    artifact.setArtifactId("artifactId");
    artifact.setVersion("version");
    module.addDependency(artifact.getGavc(), Scope.TEST);
    dependencies.add(module);
    when(repositoryHandler.getAncestors((DbArtifact) anyObject(), (FiltersHolder) anyObject())).thenReturn(dependencies);
    when(repositoryHandler.getArtifact(artifact.getGavc())).thenReturn(artifact);
    WebResource resource = client().resource("/" + ServerAPI.ARTIFACT_RESOURCE + "/" + artifact.getGavc() + ServerAPI.GET_ANCESTORS);
    ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
    assertNotNull(response);
    assertEquals(HttpStatus.OK_200, response.getStatus());
    final List<Dependency> dependencyList = response.getEntity(new GenericType<List<Dependency>>(){});
    assertNotNull(dependencyList);
    assertEquals(1, dependencyList.size());
    assertEquals(module.getName(), dependencyList.get(0).getSourceName());
    assertEquals(module.getVersion(), dependencyList.get(0).getSourceVersion());
    assertEquals(artifact.getGavc(), dependencyList.get(0).getTarget().getGavc());
    assertEquals(Scope.TEST, dependencyList.get(0).getScope());
}