AwsEcrAuthResolver implements DockerRegistryDynamicAuthResolver { @Override public Map<String, AuthConfig> getXRegistryConfig() { Map<String, AuthConfig> dynamicAuthConfigs = new HashMap<>(); for (String registry : awsEcrInitialAuthConfig.getAuthConfigs().keySet()) { AuthConfig authConfig = getXRegistryAuth(registry); if (authConfig != null) { dynamicAuthConfigs.put(registry, authConfig); } } return dynamicAuthConfigs; } @Inject  AwsEcrAuthResolver(AwsEcrInitialAuthConfig awsInitialAuthConfig); @Override @Nullable AuthConfig getXRegistryAuth(@Nullable String registry); @Override Map<String, AuthConfig> getXRegistryConfig();  }
@Test public void shouldReturnEmptyMapWhenGetDynamicXRegistryConfigIfCredentialsIsNotConfigured() { when(awsEcrInitialAuthConfig.getAuthConfigs()).thenReturn(new HashMap<>()); Map<String, AuthConfig> authConfigsMap = awsEcrAuthResolver.getXRegistryConfig(); assertTrue(authConfigsMap.size() == 0); }