GarageServiceImpl2 implements GarageService2 { @Override public Car addCar(@FluentValid Car car) { System.out.println(car); return car; }  @Override List<Car> addCars(@FluentValid(NotEmptyValidator.class) List<Car> cars); @Override List<Car> addCarsThrowException(@FluentValid List<Car> cars); @Override Car addCar(@FluentValid Car car); @Override Garage buildGarage(@FluentValid Garage garage);  }
@Test public void testAddCarsPositiveNull() { garageService.addCar(null); }
@Test public void testAddCar() { garageService.addCar(new Car("BMW", "LA1234", 5)); }
@Test public void testAddCarInvalidLicense() { try { garageService.addCar(new Car("BMW", "XXXXX1234", 5)); } catch (CarException e) { assertThat(e.getClass().getName(), is(CarException.class.getName())); assertThat(e.getMessage(), is(String.format(CarError.LICENSEPLATE_ERROR.msg(), "XXXXX1234"))); } }
@Test public void testAddCarMultipleError() { try { garageService.addCar(new Car("BMW", "XXXXX1234", 0)); } catch (CarException e) { assertThat(e.getClass().getName(), is(CarException.class.getName())); assertThat(e.getMessage(), is(String.format(CarError.LICENSEPLATE_ERROR.msg(), "XXXXX1234"))); } }