Skip to content

Commit

Permalink
#874 - fix integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
cbellone committed Mar 22, 2020
1 parent e16b8d3 commit f5c8537
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -65,7 +65,6 @@
import com.opencsv.CSVReader;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.Assert;
import org.junit.Test;
Expand Down Expand Up @@ -371,7 +370,9 @@ public void reservationFlowTest() throws Exception {
//
List<EventStatistic> eventStatistic = eventStatisticsManager.getAllEventsWithStatistics(user);
assertEquals(1, eventStatistic.size());
assertTrue(eventStatisticsManager.getTicketSoldStatistics(event.getId(), new Date(0), DateUtils.addDays(new Date(), 1)).isEmpty());
var statisticsFrom = ZonedDateTime.now(event.getZoneId()).minusYears(1);
var statisticsTo = ZonedDateTime.now(event.getZoneId()).plusDays(1);
assertEquals(0L, eventStatisticsManager.getTicketSoldStatistics(event.getId(), statisticsFrom, statisticsTo, false).stream().mapToLong(TicketsByDateStatistic::getCount).sum());
EventWithAdditionalInfo eventWithAdditionalInfo = eventStatisticsManager.getEventWithAdditionalInfo(event.getShortName(), user);
assertEquals(2, eventWithAdditionalInfo.getNotSoldTickets()); // <- 2 tickets are the bounded category
assertEquals(0, eventWithAdditionalInfo.getSoldTickets());
Expand Down Expand Up @@ -1048,7 +1049,7 @@ public void reservationFlowTest() throws Exception {
assertEquals(CheckInStatus.ALREADY_CHECK_IN, ticketAndCheckInResultOk.getResult().getStatus());

// check stats after check in one ticket
assertFalse(eventStatisticsManager.getTicketSoldStatistics(event.getId(), new Date(0), DateUtils.addDays(new Date(), 1)).isEmpty());
assertFalse(eventStatisticsManager.getTicketSoldStatistics(event.getId(), statisticsFrom, statisticsTo, false).isEmpty());
EventWithAdditionalInfo eventWithAdditionalInfo3 = eventStatisticsManager.getEventWithAdditionalInfo(event.getShortName(), user);
assertEquals(2, eventWithAdditionalInfo3.getNotSoldTickets());
assertEquals(0, eventWithAdditionalInfo3.getSoldTickets());
Expand All @@ -1075,7 +1076,7 @@ public void reservationFlowTest() throws Exception {


// check stats after revert check in one ticket
assertFalse(eventStatisticsManager.getTicketSoldStatistics(event.getId(), new Date(0), DateUtils.addDays(new Date(), 1)).isEmpty());
assertFalse(eventStatisticsManager.getTicketSoldStatistics(event.getId(), statisticsFrom, statisticsTo, false).isEmpty());
EventWithAdditionalInfo eventWithAdditionalInfo4 = eventStatisticsManager.getEventWithAdditionalInfo(event.getShortName(), user);
assertEquals(2, eventWithAdditionalInfo4.getNotSoldTickets());
assertEquals(1, eventWithAdditionalInfo4.getSoldTickets());
Expand Down

0 comments on commit f5c8537

Please sign in to comment.