@Test
public void testDeleteDestination() throws Exception {

    //Create a Destination to delete
    CreateDestinationRequest request = new CreateDestinationRequest();
    final String destination = "/foo/bar";
    final String email = "foo@bar.com";
    final int consumedRetention = new Random().nextInt();
    final int unconsumedRetention = new Random().nextInt();
    request.setPath(destination);
    request.setOwnerEmail(email);
    request.setType(DestinationType.PLAIN);
    request.setConsumedMessagesRetention(consumedRetention);
    request.setUnconsumedMessagesRetention(unconsumedRetention);
    DestinationDescription response = client.createDestination(request);
    assert (response.getPath().equals(destination));
    assert (response.getOwnerEmail().equals(email));
    DeleteDestinationRequest deleteRequest = new DeleteDestinationRequest();
    deleteRequest.setPath(destination);
    //Simple test case where we delete an existing Destination
    try {
        client.deleteDestination(deleteRequest);
    } catch (RuntimeException e) {
        assert (false);
    }
    //Client should not be able to delete a nonexistent Destination
    thrown.expect(EntityNotExistsError.class);
    client.deleteDestination(deleteRequest);
}