2121import static org .junit .Assert .assertSame ;
2222import static org .junit .Assert .fail ;
2323
24+ import com .google .protobuf .ServiceException ;
2425import java .io .IOException ;
2526import java .lang .reflect .Field ;
26- import java .lang .reflect .InvocationTargetException ;
2727import java .net .URL ;
2828import java .net .URLClassLoader ;
2929import java .util .concurrent .CompletableFuture ;
@@ -73,10 +73,9 @@ public void testObtainToken() throws Exception {
7373 shouldInjectFault .set (null , injected );
7474
7575 try {
76- clientTokenUtil .getMethod ("obtainToken" , Connection .class )
77- .invoke (null , new Object [] { null });
76+ ClientTokenUtil .obtainToken ((Connection )null );
7877 fail ("Should have injected exception." );
79- } catch (InvocationTargetException e ) {
78+ } catch (IOException e ) {
8079 Throwable t = e ;
8180 boolean serviceExceptionFound = false ;
8281 while ((t = t .getCause ()) != null ) {
@@ -90,8 +89,7 @@ public void testObtainToken() throws Exception {
9089 }
9190 }
9291
93- CompletableFuture <?> future = (CompletableFuture <?>) clientTokenUtil
94- .getMethod ("obtainToken" , AsyncConnection .class ).invoke (null , new Object [] { null });
92+ CompletableFuture <?> future = ClientTokenUtil .obtainToken ((AsyncConnection )null );
9593 try {
9694 future .get ();
9795 fail ("Should have injected exception." );
0 commit comments