Search in sources :

Example 1 with CredentialRetrievalException

use of com.google.cloud.tools.jib.registry.credentials.CredentialRetrievalException in project jib by GoogleContainerTools.

the class RegistryCredentialRetrieverTest method testCall_exception.

@Test
public void testCall_exception() throws CacheDirectoryCreationException {
    CredentialRetrievalException credentialRetrievalException = Mockito.mock(CredentialRetrievalException.class);
    BuildContext buildContext = makeFakeBuildContext(Collections.singletonList(() -> {
        throw credentialRetrievalException;
    }), Collections.emptyList());
    try {
        RegistryCredentialRetriever.getBaseImageCredential(buildContext);
        Assert.fail("Should have thrown exception");
    } catch (CredentialRetrievalException ex) {
        Assert.assertSame(credentialRetrievalException, ex);
    }
}
Also used : BuildContext(com.google.cloud.tools.jib.configuration.BuildContext) CredentialRetrievalException(com.google.cloud.tools.jib.registry.credentials.CredentialRetrievalException) Test(org.junit.Test)

Example 2 with CredentialRetrievalException

use of com.google.cloud.tools.jib.registry.credentials.CredentialRetrievalException in project jib by google.

the class RegistryCredentialRetrieverTest method testCall_exception.

@Test
public void testCall_exception() throws CacheDirectoryCreationException {
    CredentialRetrievalException credentialRetrievalException = Mockito.mock(CredentialRetrievalException.class);
    BuildContext buildContext = makeFakeBuildContext(Collections.singletonList(() -> {
        throw credentialRetrievalException;
    }), Collections.emptyList());
    try {
        RegistryCredentialRetriever.getBaseImageCredential(buildContext);
        Assert.fail("Should have thrown exception");
    } catch (CredentialRetrievalException ex) {
        Assert.assertSame(credentialRetrievalException, ex);
    }
}
Also used : BuildContext(com.google.cloud.tools.jib.configuration.BuildContext) CredentialRetrievalException(com.google.cloud.tools.jib.registry.credentials.CredentialRetrievalException) Test(org.junit.Test)

Aggregations

BuildContext (com.google.cloud.tools.jib.configuration.BuildContext)2 CredentialRetrievalException (com.google.cloud.tools.jib.registry.credentials.CredentialRetrievalException)2 Test (org.junit.Test)2