@Test public void testMultipleCarCreation() throws DBException { Motorcycle motorcycle = createMotorcycle( "Motorcycle", "toyota_rav4_2014.jpg", "Honda", "CB600F Hornet", 2007, 0.6, "Бензин", 6, 60, true, "4-тактный", "Цепь", "Street"); Motorcycle motorcycle2 = createMotorcycle( "Car", "toyota_rav4_2014.jpg", "Honda", "CB600F Hornet", 2007, 0.6, "Бензин", 6, 60, true, "4-тактный", "Цепь", "Street"); Motorcycle motorcycle3 = createMotorcycle( "Motorcycle", "toyota_rav4_2014.jpg", "Suzuki", "SV", 2006, 0.6, "Бензин", 5.5, 50, true, "2-тактный", "Цепь", "Street"); motorcycleDAOImpl.create(motorcycle); motorcycleDAOImpl.create(motorcycle2); motorcycleDAOImpl.create(motorcycle3); List<Motorcycle> motorcycles = motorcycleDAOImpl.getAll(); assertEquals(2, motorcycles.size()); }
@Test public void testCreate() throws DBException { Motorcycle motorcycle = createMotorcycle( "Motorcycle", "toyota_rav4_2014.jpg", "Honda", "CB600F Hornet", 2007, 0.6, "Бензин", 6, 60, true, "4-тактный", "Цепь", "Street"); Motorcycle motorcycle2 = createMotorcycle( "Car", "toyota_rav4_2014.jpg", "Honda", "CB600F Hornet", 2007, 0.6, "Бензин", 6, 60, true, "4-тактный", "Цепь", "Street"); motorcycleDAOImpl.create(motorcycle); motorcycleDAOImpl.create(motorcycle2); Motorcycle motorcycleFromDB = motorcycleDAOImpl.getByMake(motorcycle.getMake()); assertNotNull(motorcycleFromDB); assertEquals(motorcycle.getCarId(), motorcycleFromDB.getCarId()); assertEquals(motorcycle.getVehicleType(), motorcycleFromDB.getVehicleType()); assertEquals(motorcycle.getImage(), motorcycleFromDB.getImage()); assertEquals(motorcycle.getMake(), motorcycleFromDB.getMake()); assertEquals(motorcycle.getModel(), motorcycleFromDB.getModel()); assertEquals(motorcycle.getProductionYear(), motorcycleFromDB.getProductionYear()); assertEquals(motorcycle.getEngineCapacity(), motorcycleFromDB.getEngineCapacity(), 0.0); assertEquals(motorcycle.getFuelType(), motorcycleFromDB.getFuelType()); assertEquals(motorcycle.getFuelConsumption(), motorcycleFromDB.getFuelConsumption(), 0.0); assertEquals(motorcycle.getRentPrice(), motorcycleFromDB.getRentPrice(), 0.0); assertEquals(motorcycle.isAvailable(), motorcycleFromDB.isAvailable()); assertEquals(motorcycle.getEngineTypeByStrokes(), motorcycleFromDB.getEngineTypeByStrokes()); assertEquals(motorcycle.getDriveType(), motorcycleFromDB.getDriveType()); assertEquals(motorcycle.getMotorcycleType(), motorcycleFromDB.getMotorcycleType()); }