@Test
public void testListDestinations() throws Exception {

    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);
    client.createDestination(request);
    ListDestinationsRequest listRequest = new ListDestinationsRequest();
    listRequest.setPrefix("/");
    client.listDestinations(listRequest);
    listRequest.setPrefix("/invalidPrefix");
    thrown.expect(BadRequestError.class);
    client.listDestinations(listRequest);
}