Skip to content

Commit

Permalink
Don't use reflection where not necessary in TestClientTokenUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
srdo committed Sep 18, 2019
1 parent d1979be commit facfe8a
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -73,10 +72,9 @@ public void testObtainToken() throws Exception {
shouldInjectFault.set(null, injected);

try {
clientTokenUtil.getMethod("obtainToken", Connection.class)
.invoke(null, new Object[] { null });
ClientTokenUtil.obtainToken((Connection)null);
fail("Should have injected exception.");
} catch (InvocationTargetException e) {
} catch (IOException e) {
Throwable t = e;
boolean serviceExceptionFound = false;
while ((t = t.getCause()) != null) {
Expand All @@ -90,8 +88,7 @@ public void testObtainToken() throws Exception {
}
}

CompletableFuture<?> future = (CompletableFuture<?>) clientTokenUtil
.getMethod("obtainToken", AsyncConnection.class).invoke(null, new Object[] { null });
CompletableFuture<?> future = ClientTokenUtil.obtainToken((AsyncConnection)null);
try {
future.get();
fail("Should have injected exception.");
Expand Down

0 comments on commit facfe8a

Please sign in to comment.