EventBuilder { public EventBuilder setEventData(Eventful oldEntity, Eventful newEntity) { if (!event.getType().equals(Type.MODIFIED)) { throw new IseException("This method is only for type MODIFIED Events."); } setEventData(oldEntity); return setEventData(newEntity); } EventBuilder(EventFactory factory, Target target, Type type); EventBuilder setEventData(Eventful oldEntity, Eventful newEntity); EventBuilder setEventData(Eventful entity); Event buildEvent();  }
@Test public void testSetEventDataForNonModifiedEventsThrowsIesException() { Pool pool = mock(Pool.class); eventBuilder = new EventBuilder(factory, Event.Target.POOL, Event.Type.CREATED); exceptions.expect(IseException.class); exceptions.expectMessage("This method is only for type MODIFIED Events."); eventBuilder.setEventData(pool, pool); }