AlertListenerMessageFactory { AlertListenerMessage createAlertListenerMessage(final DistributedMember member, final AlertLevel alertLevel, final Instant timestamp, final String connectionName, final String threadName, final long threadId, final String formattedMessage, final String stackTrace) { verifyDistributedMemberCanReceiveMessage(member); return create(member, alertLevel.intLevel(), timestamp, connectionName, threadName, threadId, formattedMessage, stackTrace); }    }
@Test public void createAlertListenerMessage() { AlertListenerMessage message = alertListenerMessageFactory.createAlertListenerMessage(member, AlertLevel.WARNING, Instant.now(), "connectionName", "threadName", Thread.currentThread().getId(), "formattedMessage", null); assertThat(message).isNotNull(); assertThat(message.getDSFID()).isEqualTo(ALERT_LISTENER_MESSAGE); assertThat(message.sendViaUDP()).isTrue(); }
@Test public void createAlertListenerMessage_requiresInternalDistributedMember() { member = mock(DistributedMember.class); Throwable thrown = catchThrowable( () -> alertListenerMessageFactory.createAlertListenerMessage(member, AlertLevel.WARNING, Instant.now(), "connectionName", "threadName", Thread.currentThread().getId(), "formattedMessage", null)); assertThat(thrown).isNotNull().isInstanceOf(IllegalArgumentException.class); }