Test is more resilient to external service failures

master r5.0.0
Mauro Mugnaini 3 years ago
parent 1424b10942
commit 19e98cef4b

@ -8,14 +8,20 @@ import org.gcube.keycloak.oidc.avatar.importer.libravatar.Libravatar;
import org.gcube.keycloak.oidc.avatar.importer.libravatar.LibravatarDefaultImage;
import org.gcube.keycloak.oidc.avatar.importer.libravatar.LibravatarException;
import org.gcube.keycloak.oidc.avatar.importer.libravatar.LibravatarOptions;
import org.junit.AssumptionViolatedException;
import org.junit.Test;
public class AvatarTest {
@Test
public void testOK() throws LibravatarException {
InputStream is = Libravatar.from("mauro.mugnaini@nubisware.com").withOptions(new LibravatarOptions().withHttps()).download();
assertNotNull(is);
public void testOK() {
try {
InputStream is = Libravatar.from("mauro.mugnaini@nubisware.com").withOptions(new LibravatarOptions().withHttps()).download();
assertNotNull(is);
} catch (LibravatarException e) {
// Remote system is not working properly
throw new AssumptionViolatedException("Cannot connect with external service", e);
}
}
@Test(expected = LibravatarException.class)

Loading…
Cancel
Save