@Test public void testGetTicketPrice() { User testUser = createUser(); Event testHighRatedEvent = createEvent(); Event testEvent = createEvent(); Auditorium testAuditorium = createAuditorium(); eventService.assignAuditoriumToEvent(testHighRatedEvent, TESTED_DATE_2, testAuditorium); Assert.assertEquals( bookingService.getTicketPrice(testHighRatedEvent, TESTED_DATE_2, 10, testUser), HIGH_RATED_EVENT_PRICE, 0); Assert.assertEquals( bookingService.getTicketPrice(testHighRatedEvent, TESTED_DATE_2, 1, testUser), HIGH_RATEDEVENT_PRICE_VIP_SEAT, 0); testEvent.setRating(EventRating.MID); eventService.assignAuditoriumToEvent(testEvent, TESTED_DATE_2.plus(1), testAuditorium); Assert.assertEquals( bookingService.getTicketPrice(testEvent, TESTED_DATE_2.plus(1), 10, testUser), EVENT_BASE_PRICE, 0); Assert.assertEquals( bookingService.getTicketPrice(testEvent, TESTED_DATE_2.plus(1), 1, testUser), EVENT_PRICE_VIP_SEAT, 0); }
private Event createEvent() { Event event = new Event(); Set<DateTime> sessionSet = new TreeSet<DateTime>(); sessionSet.add(TESTED_DATE); event.setName("Panda 4DX"); event.setRating(EventRating.HIGH); event.setSessionsSet(sessionSet); event.setBasePrice(EVENT_BASE_PRICE); return event; }