@Test
    void testClientClosedAndCredentialsDecoded(@Mock final CloseableHttpClient closeableHttpClient,
            @Mock final CloseableHttpResponse closeableHttpResponse,
            @Mock final StatusLine statusLine)
            throws IOException, MojoExecutionException {

        final HttpEntity entity = new StringEntity("{\"authorizationData\": [{"
          +"\"authorizationToken\": \"QVdTOnBhc3N3b3Jk\","
          +"\"expiresAt\": 1448878779.809,"
          +"\"proxyEndpoint\": \"https://012345678910.dkr.ecr.eu-west-1.amazonaws.com\"}]}");

        Mockito.doReturn(closeableHttpResponse).when(closeableHttpClient).execute(Mockito.any(HttpUriRequest.class));
        Mockito.doReturn(statusLine).when(closeableHttpResponse).getStatusLine();
        Mockito.doReturn(200).when(statusLine).getStatusCode();
        Mockito.doReturn(entity).when(closeableHttpResponse).getEntity();

        EcrExtendedAuth eea = new EcrExtendedAuth(logger, "123456789012.dkr.ecr.eu-west-1.amazonaws.com") {
            CloseableHttpClient createClient() {
                return closeableHttpClient;
            }
        };

        AuthConfig localCredentials = new AuthConfig("username", "password", null, null);
        AuthConfig awsCredentials = eea.extendedAuth(localCredentials);
        Assertions.assertEquals("AWS", awsCredentials.getUsername());
        Assertions.assertEquals("password", awsCredentials.getPassword());

        Mockito.verify(closeableHttpClient).close();
    }
Test exchange of local stored credentials for temporary ecr credentials

@author chas
@since 2016-12-21
src/test/java/io/fabric8/maven/docker/access/ecr/EcrExtendedAuthTest.java