@Test public void testBUpdateEvent() { String updatedEventName = "Event update"; Event eventToUpdate = _eventRepository.findById(1L).orElse(null); eventToUpdate.setName(updatedEventName); try { _eventService.update(eventToUpdate); } catch (IpatException e) { fail(String.format("Error when updating event\nerrorCode: %s", e.getErrorInfos().get(0).getErrorCode())); } assertEquals(1L, _eventRepository.count()); Event updatedEvent = _eventRepository.findById(1L).orElse(null); assertEquals(updatedEventName, updatedEvent.getName()); }
public Event update(Event event) throws IpatException { IpatPreconditions.checkNotNull(event, ErrorCodes.EVENT_IS_NULL); IpatPreconditions.checkNotNull(event.getId(), ErrorCodes.EVENT_ALREADY_EXISTS); return eventRepository.save(event); }
EventService { public Event update(Event event) throws IpatException { IpatPreconditions.checkNotNull(event, ErrorCodes.EVENT_IS_NULL); IpatPreconditions.checkNotNull(event.getId(), ErrorCodes.EVENT_ALREADY_EXISTS); return eventRepository.save(event); } }
EventService { public Event update(Event event) throws IpatException { IpatPreconditions.checkNotNull(event, ErrorCodes.EVENT_IS_NULL); IpatPreconditions.checkNotNull(event.getId(), ErrorCodes.EVENT_ALREADY_EXISTS); return eventRepository.save(event); }  }
EventService { public Event update(Event event) throws IpatException { IpatPreconditions.checkNotNull(event, ErrorCodes.EVENT_IS_NULL); IpatPreconditions.checkNotNull(event.getId(), ErrorCodes.EVENT_ALREADY_EXISTS); return eventRepository.save(event); }  Event create(Event event); Event getEvent(Long eventId); @Transactional void delete(Long eventId); Event update(Event event); @Transactional void generateCodes(Long eventId, List<Long> cartIds); }
EventService { public Event update(Event event) throws IpatException { IpatPreconditions.checkNotNull(event, ErrorCodes.EVENT_IS_NULL); IpatPreconditions.checkNotNull(event.getId(), ErrorCodes.EVENT_ALREADY_EXISTS); return eventRepository.save(event); }  Event create(Event event); Event getEvent(Long eventId); @Transactional void delete(Long eventId); Event update(Event event); @Transactional void generateCodes(Long eventId, List<Long> cartIds);  }