added more tests to Throwables

This commit is contained in:
Adrian Cole 2011-04-23 16:56:34 -07:00
parent b37e00fffe
commit 440660335d
2 changed files with 9 additions and 0 deletions

View File

@ -164,6 +164,8 @@ public class SyncProxyTest {
public void setUp() throws IllegalArgumentException, SecurityException, NoSuchMethodException {
sync = SyncProxy.proxy(Sync.class, new SyncProxy(Sync.class, new Async(),
new ConcurrentHashMap<ClassMethodArgs, Object>(), ImmutableMap.<Class<?>, Class<?>> of()));
// just to warm up
sync.string();
}
@Test

View File

@ -24,6 +24,8 @@ import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
import static org.jclouds.util.Throwables2.returnFirstExceptionIfInListOrThrowStandardExceptionOrCause;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.net.SocketException;
import java.util.concurrent.TimeoutException;
import org.jclouds.http.HttpCommand;
@ -51,6 +53,11 @@ public class Throwables2Test {
assertEquals(getFirstThrowableOfType(pex, AuthorizationException.class), aex);
}
public void testGetFirstThrowableOfTypeSubclass() {
SocketException aex = createMock(SocketException.class);
assertEquals(getFirstThrowableOfType(aex, IOException.class), aex);
}
public void testGetFirstThrowableOfTypeOuter() {
AuthorizationException aex = createMock(AuthorizationException.class);
assertEquals(getFirstThrowableOfType(aex, AuthorizationException.class), aex);