Skip to content

Commit

Permalink
#318 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Aug 9, 2017
1 parent e48535b commit dd6cce8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/main/java/alfio/manager/EventManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public class EventManager {
private final UserManager userManager;
private final EventRepository eventRepository;
private final EventDescriptionRepository eventDescriptionRepository;
private final EventStatisticsManager eventStatisticsManager;
private final TicketCategoryRepository ticketCategoryRepository;
private final TicketCategoryDescriptionRepository ticketCategoryDescriptionRepository;
private final TicketRepository ticketRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
public class EventWithStatistics implements StatisticsContainer, Comparable<EventWithStatistics>, PriceContainer {

public static final DateTimeFormatter JSON_DATE_FORMATTER = DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm");
public static final Predicate<TicketCategoryWithStatistic> IS_BOUNDED = TicketCategoryWithStatistic::isBounded;
private static final Predicate<TicketCategoryWithStatistic> IS_BOUNDED = TicketCategoryWithStatistic::isBounded;

@Delegate(excludes = {EventHiddenFieldContainer.class, PriceContainer.class})
@JsonIgnore
Expand Down
15 changes: 6 additions & 9 deletions src/test/java/alfio/manager/EventManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import alfio.model.Ticket;
import alfio.model.TicketCategory;
import alfio.model.TicketCategoryStatisticView;
import alfio.model.modification.TicketCategoryWithStatistic;
import alfio.model.user.Organization;
import alfio.repository.*;
import com.insightfullogic.lambdabehave.JunitSuiteRunner;
Expand Down Expand Up @@ -58,7 +57,7 @@ public class EventManagerTest {{
TicketCategory updated = mock(TicketCategory.class);
TicketRepository ticketRepository = it.usesMock(TicketRepository.class);
NamedParameterJdbcTemplate jdbc = it.usesMock(NamedParameterJdbcTemplate.class);
EventManager eventManager = new EventManager(null, null, null, null, null, null, ticketRepository, null, null, jdbc, null, pluginManager, null, null, null, null, null, null);
EventManager eventManager = new EventManager(null, null, null, null, null, ticketRepository, null, null, jdbc, null, pluginManager, null, null, null, null, null, null);
when(original.getId()).thenReturn(20);
when(updated.getId()).thenReturn(30);
when(original.getSrcPriceCts()).thenReturn(1000);
Expand Down Expand Up @@ -95,7 +94,7 @@ public class EventManagerTest {{

describe("handlePriceChange", it -> {
TicketRepository ticketRepository = it.usesMock(TicketRepository.class);
EventManager eventManager = new EventManager(null, null, null, null, null, null, ticketRepository, null, null, null, null, pluginManager, null, null, null, null, null, null);
EventManager eventManager = new EventManager(null, null, null, null, null, ticketRepository, null, null, null, null, pluginManager, null, null, null, null, null, null);
TicketCategory original = mock(TicketCategory.class);
TicketCategory updated = mock(TicketCategory.class);
Event event = mock(Event.class);
Expand Down Expand Up @@ -133,7 +132,7 @@ public class EventManagerTest {{
describe("handleTokenModification", it -> {
SpecialPriceRepository specialPriceRepository = it.usesMock(SpecialPriceRepository.class);
NamedParameterJdbcTemplate jdbc = it.usesMock(NamedParameterJdbcTemplate.class);
EventManager eventManager = new EventManager(null, null, null, null, null, null, null, specialPriceRepository, null, jdbc, null, pluginManager, null, null, null, null, null, null);
EventManager eventManager = new EventManager(null, null, null, null, null, null, specialPriceRepository, null, jdbc, null, pluginManager, null, null, null, null, null, null);
TicketCategory original = mock(TicketCategory.class);
TicketCategory updated = mock(TicketCategory.class);

Expand Down Expand Up @@ -196,7 +195,7 @@ public class EventManagerTest {{
int eventId = 0;
TicketCategoryRepository ticketCategoryRepository = it.usesMock(TicketCategoryRepository.class);
TicketCategoryDescriptionRepository ticketCategoryDescriptionRepository = it.usesMock(TicketCategoryDescriptionRepository.class);
EventManager eventManager = new EventManager(null, null, null, null, ticketCategoryRepository, ticketCategoryDescriptionRepository, null, null, null, null, null, pluginManager, null, null, null, null, null, null);
EventManager eventManager = new EventManager(null, null, null, ticketCategoryRepository, ticketCategoryDescriptionRepository, null, null, null, null, null, pluginManager, null, null, null, null, null, null);
Event event = mock(Event.class);
int availableSeats = 20;
when(event.getAvailableSeats()).thenReturn(availableSeats);
Expand Down Expand Up @@ -247,13 +246,11 @@ public class EventManagerTest {{
UserManager userManager = it.usesMock(UserManager.class);
SpecialPriceRepository specialPriceRepository = mock(SpecialPriceRepository.class);
when(specialPriceRepository.findAllByCategoryId(eq(categoryId))).thenReturn(Collections.emptyList());
EventStatisticsManager esm = mock(EventStatisticsManager.class);
Event event = mock(Event.class);
TicketCategory ticketCategory = it.usesMock(TicketCategory.class);
//TicketCategoryWithStatistic tc = new TicketCategoryWithStatistic(ticketCategory, Collections.emptyList(), Collections.emptyList(), event, desc);
//when(esm.loadTicketCategoryWithStats(eq(categoryId), eq(event))).thenReturn(tc);

EventManager eventManager = new EventManager(userManager, eventRepository, eventDescriptionRepository, esm, ticketCategoryRepository, ticketCategoryDescriptionRepository, ticketRepository, specialPriceRepository, null, null, null, pluginManager, null, null, null, null, null, null);

EventManager eventManager = new EventManager(userManager, eventRepository, eventDescriptionRepository, ticketCategoryRepository, ticketCategoryDescriptionRepository, ticketRepository, specialPriceRepository, null, null, null, pluginManager, null, null, null, null, null, null);
when(event.getId()).thenReturn(eventId);
when(event.getOrganizationId()).thenReturn(organizationId);
Organization organization = mock(Organization.class);
Expand Down

0 comments on commit dd6cce8

Please sign in to comment.