@Test
public void testReadDestination() throws Exception {

    // Create a Destination to read
    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));
    ReadDestinationRequest readRequest = new ReadDestinationRequest();
    readRequest.setPath(destination);
    DestinationDescription result = client.readDestination(readRequest);
    //Simple test case of reading an existing Destination
    assert (result.getPath().equals(destination));
    //Client should not be able to read from a nonexistent destination
    thrown.expect(EntityNotExistsError.class);
    readRequest.setPath("/invalid/path");
    client.readDestination(readRequest);
}