Search in sources :

Example 11 with AuditEntryRepositoryWrapper

use of com.blackducksoftware.integration.hub.alert.audit.repository.AuditEntryRepositoryWrapper in project hub-alert by blackducksoftware.

the class AuditEntryActionsTest method testResendNotificationException.

@Test
public void testResendNotificationException() {
    final AuditEntryRepositoryWrapper auditEntryRepository = Mockito.mock(AuditEntryRepositoryWrapper.class);
    final NotificationRepositoryWrapper notificationRepository = Mockito.mock(NotificationRepositoryWrapper.class);
    final VulnerabilityRepositoryWrapper vulnerabilityRepository = Mockito.mock(VulnerabilityRepositoryWrapper.class);
    final AuditNotificationRepositoryWrapper auditNotificationRepository = Mockito.mock(AuditNotificationRepositoryWrapper.class);
    final CommonDistributionRepositoryWrapper commonDistributionRepositoryWrapper = Mockito.mock(CommonDistributionRepositoryWrapper.class);
    final MockAuditEntryEntity mockAuditEntryEntity = new MockAuditEntryEntity();
    final MockNotificationEntity mockNotificationEntity = new MockNotificationEntity();
    Mockito.when(auditEntryRepository.findOne(Mockito.anyLong())).thenReturn(mockAuditEntryEntity.createEmptyEntity());
    Mockito.when(commonDistributionRepositoryWrapper.findOne(Mockito.anyLong())).thenReturn(null);
    Mockito.when(notificationRepository.findAll(Mockito.any())).thenReturn(Arrays.asList(mockNotificationEntity.createEntity()));
    final AuditEntryActions auditEntryActions = new AuditEntryActions(auditEntryRepository, new NotificationManager(notificationRepository, vulnerabilityRepository, auditEntryRepository, auditNotificationRepository), auditNotificationRepository, commonDistributionRepositoryWrapper, null, null, null, null);
    List<AuditEntryRestModel> restModel = null;
    try {
        restModel = auditEntryActions.resendNotification(1L);
        fail();
    } catch (final IllegalArgumentException e) {
        assertTrue(true);
    } catch (final IntegrationException e) {
        fail();
    }
    assertNull(restModel);
}
Also used : AuditNotificationRepositoryWrapper(com.blackducksoftware.integration.hub.alert.audit.repository.AuditNotificationRepositoryWrapper) NotificationRepositoryWrapper(com.blackducksoftware.integration.hub.alert.datasource.entity.repository.NotificationRepositoryWrapper) NotificationManager(com.blackducksoftware.integration.hub.alert.NotificationManager) IntegrationException(com.blackducksoftware.integration.exception.IntegrationException) AuditEntryRepositoryWrapper(com.blackducksoftware.integration.hub.alert.audit.repository.AuditEntryRepositoryWrapper) CommonDistributionRepositoryWrapper(com.blackducksoftware.integration.hub.alert.datasource.entity.repository.CommonDistributionRepositoryWrapper) MockNotificationEntity(com.blackducksoftware.integration.hub.alert.mock.entity.MockNotificationEntity) AuditNotificationRepositoryWrapper(com.blackducksoftware.integration.hub.alert.audit.repository.AuditNotificationRepositoryWrapper) VulnerabilityRepositoryWrapper(com.blackducksoftware.integration.hub.alert.datasource.entity.repository.VulnerabilityRepositoryWrapper) MockAuditEntryEntity(com.blackducksoftware.integration.hub.alert.audit.mock.MockAuditEntryEntity) Test(org.junit.Test)

Aggregations

AuditEntryRepositoryWrapper (com.blackducksoftware.integration.hub.alert.audit.repository.AuditEntryRepositoryWrapper)11 Test (org.junit.Test)11 ProjectData (com.blackducksoftware.integration.hub.alert.digest.model.ProjectData)5 TestGlobalProperties (com.blackducksoftware.integration.hub.alert.TestGlobalProperties)4 ChannelTest (com.blackducksoftware.integration.hub.alert.channel.ChannelTest)4 ExternalConnectionTest (com.blackducksoftware.integration.test.annotation.ExternalConnectionTest)4 MockAuditEntryEntity (com.blackducksoftware.integration.hub.alert.audit.mock.MockAuditEntryEntity)3 AuditEntryEntity (com.blackducksoftware.integration.hub.alert.audit.repository.AuditEntryEntity)3 EmailGroupChannel (com.blackducksoftware.integration.hub.alert.channel.email.EmailGroupChannel)3 CommonDistributionRepositoryWrapper (com.blackducksoftware.integration.hub.alert.datasource.entity.repository.CommonDistributionRepositoryWrapper)3 GlobalHubRepositoryWrapper (com.blackducksoftware.integration.hub.alert.datasource.entity.repository.global.GlobalHubRepositoryWrapper)3 Category (org.junit.experimental.categories.Category)3 IntegrationException (com.blackducksoftware.integration.exception.IntegrationException)2 NotificationManager (com.blackducksoftware.integration.hub.alert.NotificationManager)2 AuditNotificationRepositoryWrapper (com.blackducksoftware.integration.hub.alert.audit.repository.AuditNotificationRepositoryWrapper)2 HipChatDistributionConfigEntity (com.blackducksoftware.integration.hub.alert.channel.hipchat.repository.distribution.HipChatDistributionConfigEntity)2 ChannelRestConnectionFactory (com.blackducksoftware.integration.hub.alert.channel.rest.ChannelRestConnectionFactory)2 NotificationRepositoryWrapper (com.blackducksoftware.integration.hub.alert.datasource.entity.repository.NotificationRepositoryWrapper)2 VulnerabilityRepositoryWrapper (com.blackducksoftware.integration.hub.alert.datasource.entity.repository.VulnerabilityRepositoryWrapper)2 MockNotificationEntity (com.blackducksoftware.integration.hub.alert.mock.entity.MockNotificationEntity)2