Search in sources :

Example 1 with ProjectMockUtils

use of com.blackducksoftware.integration.hub.alert.mock.ProjectMockUtils in project hub-alert by blackducksoftware.

the class ConfiguredProjectsRepositoryWrapperTest method testFindByProjectName.

@Test
public void testFindByProjectName() throws IOException {
    final ProjectMockUtils projectMockUtils = new ProjectMockUtils();
    final ConfiguredProjectsRepository repository = Mockito.mock(ConfiguredProjectsRepository.class);
    Mockito.when(repository.findByProjectName(Mockito.anyString())).thenReturn(projectMockUtils.getProjectOneEntity());
    final ConfiguredProjectsRepositoryWrapper configuredProjectsRepositoryWrapper = new ConfiguredProjectsRepositoryWrapper(repository) {

        @Override
        public ConfiguredProjectEntity decryptSensitiveData(final ConfiguredProjectEntity entity) throws EncryptionException {
            throw new EncryptionException();
        }
    };
    final ConfiguredProjectEntity actual = configuredProjectsRepositoryWrapper.findByProjectName("any");
    assertNull(actual);
    assertTrue(outputLogger.isLineContainingText("Error finding common distribution config"));
}
Also used : ProjectMockUtils(com.blackducksoftware.integration.hub.alert.mock.ProjectMockUtils) EncryptionException(com.blackducksoftware.integration.exception.EncryptionException) ConfiguredProjectEntity(com.blackducksoftware.integration.hub.alert.datasource.entity.ConfiguredProjectEntity) Test(org.junit.Test)

Aggregations

EncryptionException (com.blackducksoftware.integration.exception.EncryptionException)1 ConfiguredProjectEntity (com.blackducksoftware.integration.hub.alert.datasource.entity.ConfiguredProjectEntity)1 ProjectMockUtils (com.blackducksoftware.integration.hub.alert.mock.ProjectMockUtils)1 Test (org.junit.Test)1