Search in sources :

Example 1 with AuthenticationTypeEntity

use of com.synopsys.integration.alert.database.user.AuthenticationTypeEntity in project hub-alert by blackducksoftware.

the class DefaultAuthenticationTypeAccessorTest method getAuthenticationTypeDetailsTest.

@Test
public void getAuthenticationTypeDetailsTest() {
    AuthenticationTypeRepository authenticationTypeRepository = Mockito.mock(AuthenticationTypeRepository.class);
    DefaultAuthenticationTypeAccessor authenticationTypeAccessor = new DefaultAuthenticationTypeAccessor(authenticationTypeRepository);
    AuthenticationTypeEntity authenticationTypeEntity = new AuthenticationTypeEntity("name-test");
    Mockito.when(authenticationTypeRepository.findById(Mockito.any())).thenReturn(Optional.of(authenticationTypeEntity));
    Optional<AuthenticationTypeDetails> testAuthenticationTypeDetails = authenticationTypeAccessor.getAuthenticationTypeDetails(AuthenticationType.DATABASE);
    assertTrue(testAuthenticationTypeDetails.isPresent());
    AuthenticationTypeDetails authenticationTypeDetails = testAuthenticationTypeDetails.get();
    assertEquals(authenticationTypeEntity.getName(), authenticationTypeDetails.getName());
    assertEquals(authenticationTypeEntity.getId(), authenticationTypeDetails.getId());
}
Also used : AuthenticationTypeRepository(com.synopsys.integration.alert.database.user.AuthenticationTypeRepository) AuthenticationTypeEntity(com.synopsys.integration.alert.database.user.AuthenticationTypeEntity) AuthenticationTypeDetails(com.synopsys.integration.alert.common.persistence.model.AuthenticationTypeDetails) Test(org.junit.jupiter.api.Test)

Aggregations

AuthenticationTypeDetails (com.synopsys.integration.alert.common.persistence.model.AuthenticationTypeDetails)1 AuthenticationTypeEntity (com.synopsys.integration.alert.database.user.AuthenticationTypeEntity)1 AuthenticationTypeRepository (com.synopsys.integration.alert.database.user.AuthenticationTypeRepository)1 Test (org.junit.jupiter.api.Test)1