Beispiel #1
0
 @Test
 public void testGetHasCostsWithCost() throws SQLException, IOException {
   costBean.setCostValue("12");
   costBean.setText("FOOD");
   costBean.addCost();
   assertEquals(" should be true", true, costBean.getHasCosts());
 }
Beispiel #2
0
  @Test
  public void testAddCost() throws SQLException, IOException {
    costBean.setCostValue("12");
    costBean.setText("FOOD");
    costBean.addCost();

    assertEquals("Texts should be equal", "FOOD", costService.getCostByCostId(2).getText());
  }
Beispiel #3
0
  @Test
  public void testCancelCost() throws SQLException, IOException {

    costBean.setCostValue("12");
    costBean.setText("FOOD");
    costBean.addCost();
    costBean.editCost(costBean.getCurrentCost());
    costBean.cancel();

    assertEquals("Texts should be equal", "", costBean.getNewtext());
  }
Beispiel #4
0
  @Test
  public void testDeleteCost() throws SQLException, IOException {
    costBean.setCostValue("12");
    costBean.setText("FOOD");
    costBean.addCost();
    costBean.deleteCost(costBean.getCurrentCost());

    assertEquals(
        "size should be equal", 0, costService.getCostsByTrip(costBean.getCurrentTrip()).size());
  }
Beispiel #5
0
  @Test
  public void testUpdateCost() throws SQLException, IOException {
    costBean.setCostValue("12");
    costBean.setText("FOOD");
    costBean.addCost();
    costBean.setNewcostValue("30");
    costBean.setNewtext("BEER");
    costBean.updateCost();

    assertEquals("Texts should be equal", "BEER", costService.getCostByCostId(3).getText());
  }
Beispiel #6
0
  @Test
  public void testIsOrganiser() throws SQLException, IOException {

    assertEquals(" should be true", true, costBean.isOrganizer());
  }
Beispiel #7
0
  @Test
  public void testGetCostsPerTripUser() throws SQLException, IOException {

    assertEquals(
        " should be 0.0", (Object) 0.0, costBean.getCostsPerTripUser().get(0).getCostValue());
  }
Beispiel #8
0
  @Test
  public void testGetTotalCostPerUser() throws SQLException, IOException {

    assertEquals(" should be 0.0", (Object) 0.0, costBean.getTotalCostPerUser(loginBean.getUser()));
  }
Beispiel #9
0
  @Test
  public void testGetConfirmedUsers() throws SQLException, IOException {

    assertEquals(" should be 1", 1, costBean.getConfirmedTripUsers().size());
  }
Beispiel #10
0
  @Test
  public void testGetHasCostsWithNoCost() throws SQLException, IOException {

    assertEquals(" should be false", false, costBean.getHasCosts());
  }