TSK-1308: Format corrections.

This commit is contained in:
Holger Hagen 2021-07-08 15:55:10 +02:00 committed by holgerhagen
parent 1ba7aebc2d
commit 9375b3ead2
3 changed files with 36 additions and 45 deletions

View File

@ -15,7 +15,7 @@ import pro.taskana.common.test.rest.TaskanaSpringBootTest;
class LdapEmptySearchRootsTest extends LdapTest {
@Test
void should_findGroupsForUser_When_UserIdIsProvided() throws Exception {
void should_FindGroupsForUser_When_UserIdIsProvided() throws Exception {
List<AccessIdRepresentationModel> groups =
ldapClient.searchGroupsAccessIdIsMemberOf("user-2-2");
assertThat(groups)
@ -27,7 +27,7 @@ class LdapEmptySearchRootsTest extends LdapTest {
}
@Test
void should_returnFullDnForUser_When_AccessIdOfUserIsGiven() {
void should_ReturnFullDnForUser_When_AccessIdOfUserIsGiven() {
String dn = ldapClient.searchDnForAccessId("otheruser");
assertThat(dn).isEqualTo("uid=otheruser,cn=other-users,ou=test,o=taskana");
}

View File

@ -10,17 +10,14 @@ import pro.taskana.common.rest.ldap.LdapClient;
import pro.taskana.common.rest.models.AccessIdRepresentationModel;
import pro.taskana.common.test.rest.TaskanaSpringBootTest;
/**
* Test Ldap attachment.
*/
/** Test Ldap attachment. */
@TaskanaSpringBootTest
class LdapTest {
@Autowired
LdapClient ldapClient;
@Autowired LdapClient ldapClient;
@Test
void testFindUsers() throws Exception {
void should_FindAllUsersAndGroup_When_SearchWithSubstringOfName() throws Exception {
List<AccessIdRepresentationModel> usersAndGroups = ldapClient.searchUsersAndGroups("lead");
assertThat(usersAndGroups)
.extracting(AccessIdRepresentationModel::getAccessId)
@ -29,7 +26,7 @@ class LdapTest {
}
@Test
void should_findUserByWholeName_WhenSearchingWithLdapClient() throws Exception {
void should_FindUser_When_SearchingWithFirstAndLastname() throws Exception {
List<AccessIdRepresentationModel> usersAndGroups = ldapClient.searchUsersAndGroups("Elena");
assertThat(usersAndGroups).hasSize(2);
@ -38,19 +35,17 @@ class LdapTest {
}
@Test
void should_findGroupsForUser_When_UserIdIsProvided() throws Exception {
List<AccessIdRepresentationModel> groups = ldapClient
.searchGroupsAccessIdIsMemberOf("user-2-2");
void should_FindGroupsForUser_When_UserIdIsProvided() throws Exception {
List<AccessIdRepresentationModel> groups =
ldapClient.searchGroupsAccessIdIsMemberOf("user-2-2");
assertThat(groups)
.extracting(AccessIdRepresentationModel::getAccessId)
.containsExactlyInAnyOrder(
"cn=ksc-users,cn=groups,ou=test,o=taskana");
.containsExactlyInAnyOrder("cn=ksc-users,cn=groups,ou=test,o=taskana");
}
@Test
void should_returnFullDnForUser_When_AccessIdOfUserIsGiven() {
void should_FeturnFullDnForUser_When_AccessIdOfUserIsGiven() {
String dn = ldapClient.searchDnForAccessId("user-2-2");
assertThat(dn).isEqualTo("uid=user-2-2,cn=users,ou=test,o=taskana");
}
}

View File

@ -35,17 +35,13 @@ import pro.taskana.common.rest.models.AccessIdRepresentationModel;
@ExtendWith(MockitoExtension.class)
class LdapClientTest {
@Mock
Environment environment;
@Mock Environment environment;
@Mock
LdapTemplate ldapTemplate;
@Mock LdapTemplate ldapTemplate;
@Mock
TaskanaEngineConfiguration taskanaEngineConfiguration;
@Mock TaskanaEngineConfiguration taskanaEngineConfiguration;
@InjectMocks
LdapClient cut;
@InjectMocks LdapClient cut;
@Test
void testLdap_searchGroupByDn() {