@Test
public void testConnectionCreation() {

    HttpClient httpClient = mock(HttpClient.class);
    ObjectMapper mapper = mock(ObjectMapper.class);
    SW360ConnectionFactory connectionFactory = mock(SW360ConnectionFactory.class);
    SW360Connection connection = mock(SW360Connection.class);
    when(connectionFactory.newConnection(any())).thenReturn(connection);
    SW360ConnectionConfigurationFactory factory = new SW360ConnectionConfigurationFactory(connectionFactory);
    SW360Connection actualConnection =
            factory.createConnection(stringConfigGetter(), httpClient, mapper);
    assertThat(actualConnection).isEqualTo(connection);
    ArgumentCaptor<SW360ClientConfig> captSW360Config = ArgumentCaptor.forClass(SW360ClientConfig.class);
    verify(connectionFactory).newConnection(captSW360Config.capture());
    SW360ClientConfig sw360ClientConfig = captSW360Config.getValue();
    assertThat(sw360ClientConfig.getRestURL()).isEqualTo(REST_URL);
    assertThat(sw360ClientConfig.getAuthURL()).isEqualTo(AUTH_URL);
    assertThat(sw360ClientConfig.getUser()).isEqualTo(USER);
    assertThat(sw360ClientConfig.getPassword()).isEqualTo(PASSWORD);
    assertThat(sw360ClientConfig.getClientId()).isEqualTo(CLIENT_ID);
    assertThat(sw360ClientConfig.getClientPassword()).isEqualTo(CLIENT_SECRET);
    assertThat(sw360ClientConfig.getHttpClient()).isEqualTo(httpClient);
    assertThat(sw360ClientConfig.getObjectMapper()).isEqualTo(mapper);
}