コード例 #1
0
  @Test
  public void testDeleteEntity() throws Exception {
    final String guid = random();
    Response response = mock(Response.class);
    when(response.getEntity())
        .thenReturn(
            new JSONObject() {
              {
                put(
                    ENTITIES,
                    new JSONObject(
                            new AtlasClient.EntityResult(null, null, Arrays.asList(guid))
                                .toString())
                        .get(ENTITIES));
              }
            });

    when(entityResource.deleteEntities(
            anyListOf(String.class), anyString(), anyString(), anyString()))
        .thenReturn(response);
    LocalAtlasClient atlasClient = new LocalAtlasClient(serviceState, entityResource);
    AtlasClient.EntityResult entityResult = atlasClient.deleteEntity(random(), random(), random());
    assertEquals(entityResult.getDeletedEntities(), Arrays.asList(guid));
  }