SW360Updater extends AbstractGenerator { @Override public void configure(Map<String, String> configMap) { updaterImpl = createUpdaterImpl(configMap); } SW360Updater();   SW360Updater(SW360ConnectionConfigurationFactory factory); @Override void configure(Map<String, String> configMap); @Override Map<String, IAttachable> produce(Collection<Artifact> intermediates);  }
@Test public void testConfigure() { SW360ConnectionConfigurationFactory connectionFactory = mock(SW360ConnectionConfigurationFactory.class); HttpClient httpClient = mock(HttpClient.class); ObjectMapper mapper = mock(ObjectMapper.class); SW360Connection connection = mock(SW360Connection.class); when(antennaContextMock.getHttpClient()).thenReturn(httpClient); when(antennaContextMock.getObjectMapper()).thenReturn(mapper); when(connectionFactory.createConnection(any(), eq(httpClient), eq(mapper))).thenReturn(connection); SW360Updater updater = new SW360Updater(connectionFactory); updater.setAntennaContext(antennaContextMock); Map<String, String> configMap = createConfigMap(); updater.configure(configMap); @SuppressWarnings("unchecked") ArgumentCaptor<SW360ConnectionConfigurationFactory.Getter<String>> captor = ArgumentCaptor.forClass(SW360ConnectionConfigurationFactory.Getter.class); verify(connectionFactory).createConnection(captor.capture(), eq(httpClient), eq(mapper)); SW360ConnectionConfigurationFactory.Getter<String> getter = captor.getValue(); for (Map.Entry<String, String> e : configMap.entrySet()) { assertThat(getter.apply(e.getKey())).isEqualTo(e.getValue()); } verify(connection).getReleaseAdapter(); }