예제 #1
0
  @Test
  public void placeBid_should_return_null_if_not_successful() {
    dbHandler.setReturnBid(-1);
    initProvider();
    Bid incoming = new Bid(0, 1, 3, 15000, "User3");
    String json = jsonHandler.bidToJSON(incoming);
    Bid result = provider.placeBid(json);

    assertNull(result);
  }
예제 #2
0
  @Test
  public void placeBid_should_return_the_bid_back_with_id_set_from_database() {
    Bid incoming = new Bid(0, 1, 3, 15000, "User3");
    dbHandler.setReturnBid(1);
    initProvider();
    String json = jsonHandler.bidToJSON(incoming);
    Bid result = provider.placeBid(json);

    assertNotNull(result);
    assertEquals(1, result.getBidID());
  }