@Test
  public void testEnableOffer() throws Exception {
    final TripOffer offer1 = new TripOffer.Builder().setStatus(TripOfferStatus.FINISHED).build();
    final TripOffer offer2 =
        new TripOffer.Builder()
            .setStatus(TripOfferStatus.DISABLED)
            .setLastPositonUpdateInSeconds(System.currentTimeMillis() / 1000)
            .build();

    new Expectations() {
      {
        tripOfferDAO.findAll();
        result = Lists.newArrayList(offer1, offer2);
      }
    };

    executor.doRun();

    new Verifications() {
      {
        TripOffer updatedOffer;
        tripOfferDAO.update(updatedOffer = withCapture());
        Assert.assertEquals(TripOfferStatus.ACTIVE, updatedOffer.getStatus());

        runningTripQueriesManager.checkAndUpdateRunningQueries(updatedOffer);
      }
    };
  }
  @Test
  public void testDisableOffer() throws Exception {
    final TripOffer offer1 = new TripOffer.Builder().setStatus(TripOfferStatus.FINISHED).build();
    final TripOffer offer2 =
        new TripOffer.Builder()
            .setStatus(TripOfferStatus.ACTIVE)
            .setLastPositonUpdateInSeconds(0)
            .build();

    new Expectations() {
      {
        tripOfferDAO.findAll();
        result = Lists.newArrayList(offer1, offer2);
      }
    };

    executor.doRun();

    new Verifications() {
      {
        TripOffer updatedOffer;
        tripOfferDAO.update(updatedOffer = withCapture());
        Assert.assertEquals(TripOfferStatus.DISABLED, updatedOffer.getStatus());
      }
    };
  }