1 package org.apache.thrift.async;
2 
3 import junit.framework.TestCase;
4 
5 import org.apache.thrift.TException;
6 
7 import thrift.test.Srv;
8 import thrift.test.Srv.AsyncClient;
9 
10 public class TestTAsyncClient extends TestCase {
testRaisesExceptionWhenUsedConcurrently()11   public void testRaisesExceptionWhenUsedConcurrently() throws Exception {
12     TAsyncClientManager mockClientManager = new TAsyncClientManager() {
13       @Override
14       public void call(TAsyncMethodCall method) throws TException {
15         // do nothing
16       }
17     };
18 
19     Srv.AsyncClient c = new AsyncClient(null, mockClientManager, null);
20     c.Janky(0, null);
21     try {
22       c.checkReady();
23       fail("should have hit an exception");
24     } catch (Exception e) {
25       // awesome
26     }
27   }
28 }
29