コード例 #1
0
  // @Test(dependsOnMethods = "update")
  public void delete() throws Exception {
    MotorCycle motorCycle = repository.findOne(id);

    repository.delete(motorCycle);
    MotorCycle deletedMotorCycle = repository.findOne(id);
    Assert.assertNull(deletedMotorCycle);
  }
コード例 #2
0
  // @Test(dependsOnMethods = "create")
  public void read() throws Exception {

    MotorCycle motorCycle = repository.findOne(id);
    Assert.assertNotNull(motorCycle);
    Assert.assertEquals("kawa34er", motorCycle.getSerialNumber());
    Assert.assertEquals("Kawasaki", motorCycle.getMake());
  }
コード例 #3
0
  // @Test
  public void create() throws Exception {

    List<PaymentMethod> paymentMethods = new ArrayList();
    List<Rental> rentals = new ArrayList();

    PaymentMethod paymentMethod = new PaymentMethod.Builder("Credit").Price(4000.00).build();
    paymentMethods.add(paymentMethod);

    Rental rental =
        new Rental.Builder("22-07-2015")
            .returnDate("28-07-2015")
            .paymentMethod(paymentMethods)
            .build();
    rentals.add(rental);
    MotorCycle motorCycle =
        MotorCycleFactory.createMotorCycle(
            "kawa34er",
            "Kawasaki",
            "Ninja",
            "2006",
            "2000km",
            "full",
            "Mint ",
            "600ccsd",
            "600cc",
            "Unleaded ",
            rentals);

    repository.save(motorCycle);

    id = motorCycle.getId();

    Assert.assertNotNull(motorCycle.getId());
  }