@Test
public void testFindUserIdByUserName() throws Exception {

    // Arrange
    final String id = "id";
    final String username = "username";
    final SearchResultsWrapperWithId searchResultsMock = mock(SearchResultsWrapperWithId.class);
    final IdentifierDto identifier = new IdentifierDto();
    identifier.setId(id);
    when(searchResultsMock.getResources()).thenReturn(Arrays.asList(identifier));
    when(restTemplate.getForObject(usersEndpoint + "?filter=userName eq \"" + username + "\"&attributes=id", SearchResultsWrapperWithId.class)).thenReturn(searchResultsMock);
    // Act
    final String response = sut.findUserIdByUserName(username);
    // Assert
    assertEquals(id, response);
}