@Test public void executeQuieryTest() { Request request = new Request(); request.setDepartureStation("ГРОДНО"); request.setDestinationStation("МИНСК"); request.setDepartureDate(new Timestamp(99999)); request.setArrivalDate(new Timestamp(99999)); List<TripList> resList = service.executeQuiery(request); assertFalse(resList.isEmpty()); resList.forEach( new Consumer<TripList>() { @Override public void accept(TripList tl) { assertNotNull(tl.getId()); System.out.println("Id рейса: " + tl.getId()); assertNotNull(tl.getRouteId()); System.out.println("Id маршрута: " + tl.getRouteId()); assertNotNull(tl.getTrainId()); System.out.println("Id поезда: " + tl.getTrainId()); System.out.println("Дата отправления: " + tl.getDepartureDate()); System.out.println("Продано билетов: " + tl.getTicketsSold()); System.out.println("---------------------"); cnt++; } }); System.out.println("Рейсов в выдаче: " + cnt); }
// currently not used (for now requests isn't stored in database) @Override public void setQuiery(Request request) { jdbcTemplate.update( "INSERT INTO request (departure_station, destination_station, departure_date, arrival_date) VALUES (?,?,?,?)", request.getDepartureStation(), request.getDestinationStation(), request.getDepartureDate(), request.getArrivalDate()); }
@Test public void setQuieryTest() { Request request = new Request(); request.setDepartureStation("Grodno"); request.setDestinationStation("Kukuevo"); request.setDepartureDate(new Timestamp(99999)); request.setArrivalDate(new Timestamp(99999)); service.find(request); }