### Question:
PublishingPayload { public boolean addEvent(PublishingPayloadEvent publishingPayloadEvent) { if (events.containsKey(publishingPayloadEvent.getEventIndex())){ return events.get(publishingPayloadEvent.getEventIndex()).add(publishingPayloadEvent.getAttribute()); } else { ArrayList<Integer> attributes = new ArrayList<>(2); attributes.add(publishingPayloadEvent.getAttribute()); events.put(publishingPayloadEvent.getEventIndex(), attributes); return true; } }  boolean addEvent(PublishingPayloadEvent publishingPayloadEvent); String getPayload(); void setPayload(String payload);  }### Answer:
@Test public void testAddEvent() { PublishingPayloadEvent payloadEvent = new PublishingPayloadEvent(); payloadEvent.setAttribute(new Integer(1)); payloadEvent.setEventIndex(1); Assert.assertTrue("Adding event should be successful", publishingPayload.addEvent(payloadEvent)); }