@Test
public void testListReservationsByInvalidTimeInterval() {

  ResourceManager rm = setupResourceManager();
  ClientRMService clientService = rm.getClientRMService();
  Clock clock = new UTCClock();
  long arrival = clock.getTime();
  long duration = 60000;
  long deadline = (long) (arrival + 1.05 * duration);
  ReservationSubmissionRequest sRequest =
      submitReservationTestHelper(clientService, arrival, deadline, duration);
  // List reservations, search by invalid end time == -1.
  ReservationListRequest request = ReservationListRequest
      .newInstance(ReservationSystemTestUtil.reservationQ, "", 1, -1, true);
  ReservationListResponse response = null;
  try {
    response = clientService.listReservations(request);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(response);
  Assert.assertEquals(1, response.getReservationAllocationState().size());
  Assert.assertEquals(response.getReservationAllocationState().get(0)
      .getReservationId().getId(), sRequest.getReservationId().getId());
  // List reservations, search by invalid end time < -1.
  request = ReservationListRequest
      .newInstance(ReservationSystemTestUtil.reservationQ, "", 1, -10, true);
  response = null;
  try {
    response = clientService.listReservations(request);
  } catch (Exception e) {
    Assert.fail(e.getMessage());
  }
  Assert.assertNotNull(response);
  Assert.assertEquals(1, response.getReservationAllocationState().size());
  Assert.assertEquals(response.getReservationAllocationState().get(0)
      .getReservationId().getId(), sRequest.getReservationId().getId());
  rm.stop();
}