예제 #1
0
  @Test
  @Transactional
  @Rollback
  public void testUpsert() {
    Car car = new Car();
    car.setPlateNumber("1A1 11-11");
    car.setOtherBrandName("Mercedes");
    car.setModel("C500");
    car.setMakingYear(Integer.valueOf(2000));
    car.setMotEnd(new Date());
    car.setWeight(Integer.valueOf(1000));
    car.setVehicleType(VehicleType.CAR.toString());
    car.setFuel(new FuelCT(Integer.valueOf(3001), "", ""));
    car.setSittingPlacesCount(Integer.valueOf(5));
    car.setVolume(Integer.valueOf(1200));

    Owner owner = new Owner();
    owner.setFirstname("firstname");
    owner.setLastname("lastname");
    owner.setBirthCertificateNumber("123456/7890");
    owner.setAddress("address");
    owner.setPhone1("123 456 789");
    car.setOwner(owner);

    vehicleService.upsert(car);
    Assert.assertNotNull(car.getId());
  }
예제 #2
0
  @Test
  @Transactional
  public void testGetVehicleById() {
    Long idCar = Long.valueOf(1);

    Car car = (Car) vehicleService.getVehicleById(idCar);
    Assert.assertNotNull(car);
  }
예제 #3
0
 @Test
 @Transactional
 public void testGetVehicleList() throws ParseException {
   PageData pageData = vehicleService.getVehicleList(new SearchFormBean(), 1);
   List<Vehicle> vehicleList = (List<Vehicle>) pageData.getItems();
   Assert.assertNotNull(vehicleList);
   for (Vehicle vehicle : vehicleList) {
     Assert.assertNotNull(vehicle);
   }
 }