@Test
public void checkPermissionsAssertAccessDeniedWhenNamespaceNotAuthorizedToAllRole()
{

    NamespaceEntity expectedNamespaceEntity = new NamespaceEntity();
    expectedNamespaceEntity.setCode("namespace");
    String iamRoleName1 = "iamRoleName1";
    String iamRoleName2 = "iamRoleName2";
    Collection<String> requestedIamRoleNames = Arrays.asList(iamRoleName1, iamRoleName2);
    List<NamespaceIamRoleAuthorizationEntity> namespaceIamRoleAuthorizationEntities = new ArrayList<>();
    when(configurationHelper.getBooleanProperty(any())).thenReturn(true);
    when(namespaceIamRoleAuthorizationDao.getNamespaceIamRoleAuthorizations(any())).thenReturn(namespaceIamRoleAuthorizationEntities);
    try
    {
        namespaceIamRoleAuthorizationHelper.checkPermissions(expectedNamespaceEntity, requestedIamRoleNames);
        fail();
    }
    catch (AccessDeniedException e)
    {
        assertEquals("The namespace \"namespace\" does not have access to the following IAM roles: [iamRoleName1, iamRoleName2]", e.getMessage());
    }
    verify(configurationHelper).getBooleanProperty(ConfigurationValue.NAMESPACE_IAM_ROLE_AUTHORIZATION_ENABLED);
    verify(namespaceIamRoleAuthorizationDao).getNamespaceIamRoleAuthorizations(expectedNamespaceEntity);
    verifyNoMoreInteractions(configurationHelper, namespaceIamRoleAuthorizationDao);
}