@Test
public void test_searchByGroupName_successfully() {

    DirectoryGroup dirGrp = new DirectoryGroup();
    dirGrp.setDisplayName("test_group");
    dirGrp.setEmail("testgroup@t-mobile.com");
    dirGrp.setGroupName("test_group");
    List<DirectoryGroup> allGroups = new ArrayList<>();
    allGroups.add(dirGrp);
    DirectoryObjects groups = new DirectoryObjects();
    DirectoryObjectsList groupsList = new DirectoryObjectsList();
    groupsList.setValues(allGroups.toArray(new DirectoryGroup[allGroups.size()]));
    groups.setData(groupsList);
    ResponseEntity<DirectoryObjects> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body(groups);
    when(ldapTemplate.search(Mockito.anyString(), Mockito.anyString(), Mockito.any(AttributesMapper.class))).thenReturn(allGroups);
    ResponseEntity<DirectoryObjects> responseEntity = directoryService.searchByGroupName("test_group");
    assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
    assertEquals(responseEntityExpected.getBody().getData().getValues()[0], responseEntity.getBody().getData().getValues()[0]);
}