use of com.blackducksoftware.integration.hub.alert.OutputLogger in project hub-alert by blackducksoftware.
the class RealTimeListenerTest method testReceiveMessageException.
@SuppressWarnings("unchecked")
@Test
public void testReceiveMessageException() throws IOException, Exception {
try (OutputLogger outputLogger = new OutputLogger()) {
final Gson gson = new Gson();
final MockNotificationEntity notificationEntity = new MockNotificationEntity();
final NotificationModel model = new NotificationModel(notificationEntity.createEntity(), Collections.emptyList());
final ChannelTemplateManager channelTemplateManager = Mockito.mock(ChannelTemplateManager.class);
final ProjectDataFactory projectDataFactory = Mockito.mock(ProjectDataFactory.class);
final NotificationEventManager eventManager = Mockito.mock(NotificationEventManager.class);
Mockito.doNothing().when(channelTemplateManager).sendEvents(Mockito.any());
Mockito.doThrow(new NullPointerException("null error")).when(projectDataFactory).createProjectDataCollection(Mockito.anyCollection(), Mockito.any());
final RealTimeListener realTimeListener = new RealTimeListener(gson, channelTemplateManager, projectDataFactory, eventManager);
final RealTimeEvent realTimeEvent = new RealTimeEvent(Arrays.asList(model));
final String realTimeEventString = gson.toJson(realTimeEvent);
realTimeListener.receiveMessage(realTimeEventString);
assertTrue(outputLogger.isLineContainingText("null"));
}
}
use of com.blackducksoftware.integration.hub.alert.OutputLogger in project hub-alert by blackducksoftware.
the class EmailChannelTestIT method sendEmailNullGlobalTest.
@Test
public void sendEmailNullGlobalTest() throws Exception {
final OutputLogger outputLogger = new OutputLogger();
final EmailGroupChannel emailChannel = new EmailGroupChannel(null, gson, null, null, null, null);
emailChannel.sendMessage(new EmailGroupEvent(null, 1L), null);
assertTrue(outputLogger.isLineContainingText("No configuration found with id"));
outputLogger.close();
}
use of com.blackducksoftware.integration.hub.alert.OutputLogger in project hub-alert by blackducksoftware.
the class CommonConfigTest method init.
@Before
public void init() throws IOException {
outputLogger = new OutputLogger();
globalProperties = new TestGlobalProperties();
}
use of com.blackducksoftware.integration.hub.alert.OutputLogger in project hub-alert by blackducksoftware.
the class ChannelTest method init.
@Before
public void init() throws IOException {
gson = new Gson();
properties = new TestProperties();
outputLogger = new OutputLogger();
}
use of com.blackducksoftware.integration.hub.alert.OutputLogger in project hub-alert by blackducksoftware.
the class LoginActionsTestIT method init.
@Before
public void init() throws IOException {
outputLogger = new OutputLogger();
mockLoginRestModel.setHubUsername(properties.getProperty(TestPropertyKey.TEST_USERNAME));
mockLoginRestModel.setHubPassword(properties.getProperty(TestPropertyKey.TEST_PASSWORD));
}
Aggregations