AbstractNotification implements NotificationInterface { @Override public <T> void send(NotificationType type, List<T> messages) throws NotificationException { String[] strMessages = new String[messages.size()]; for (int index = 0; index < messages.size(); index++) { strMessages[index] = getMessageJson(messages.get(index)); } sendInternal(type, strMessages); } AbstractNotification(Configuration applicationProperties); @VisibleForTesting protected  AbstractNotification(); @Override void send(NotificationType type, List<T> messages); @Override void send(NotificationType type, T... messages); static String getMessageJson(Object message); static final MessageVersion CURRENT_MESSAGE_VERSION; static final String PROPERTY_EMBEDDED; static final Gson GSON; }
@Test public void testSend() throws Exception { Configuration configuration = mock(Configuration.class); TestNotification notification = new TestNotification(configuration); TestMessage message1 = new TestMessage(HookNotification.HookNotificationType.ENTITY_CREATE, "user1"); TestMessage message2 = new TestMessage(HookNotification.HookNotificationType.TYPE_CREATE, "user1"); TestMessage message3 = new TestMessage(HookNotification.HookNotificationType.ENTITY_FULL_UPDATE, "user1"); String messageJson1 = AbstractNotification.getMessageJson(message1); String messageJson2 = AbstractNotification.getMessageJson(message2); String messageJson3 = AbstractNotification.getMessageJson(message3); notification.send(NotificationInterface.NotificationType.HOOK, message1, message2, message3); assertEquals(NotificationInterface.NotificationType.HOOK, notification.type); assertEquals(3, notification.messages.length); assertEquals(messageJson1, notification.messages[0]); assertEquals(messageJson2, notification.messages[1]); assertEquals(messageJson3, notification.messages[2]); }