public static Offer createOffer(boolean acceptable) {
    Application app = new Application();
    app.setName("John Smith");
    app.setCreditScore(acceptable ? 700 : 300);
    Car car = new Car();
    car.setPrice(18000);
    car.setVehicleId("Honda");
    Offer offer = new Offer();
    offer.setApplication(app);
    offer.setCar(car);
    offer.setAmount(17000);

    return offer;
  }
예제 #2
0
  @Test
  public void testOffer() throws Exception {

    RemoteInvoker invoker = new HttpInvoker(URL);
    Application app = new Application();
    app.setCreditScore(700);
    Car car = new Car();
    car.setPrice(18000);
    Offer offer = new Offer();
    offer.setApplication(app);
    offer.setCar(car);
    offer.setAmount(17000);

    RemoteMessage message = new RemoteMessage();
    message.setService(SERVICE).setOperation("offer").setContent(offer);

    // Invoke the service
    RemoteMessage reply = invoker.invoke(message);
    Deal deal = (Deal) reply.getContent();
    Assert.assertTrue(deal.isAccepted());
  }