File: TestTAsyncClient.java

package info (click to toggle)
libthrift-java 0.9.1-2.1~deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,192 kB
  • sloc: java: 12,634; xml: 299; makefile: 13
file content (28 lines) | stat: -rw-r--r-- 712 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package org.apache.thrift.async;

import junit.framework.TestCase;

import org.apache.thrift.TException;

import thrift.test.Srv;
import thrift.test.Srv.AsyncClient;

public class TestTAsyncClient extends TestCase {
  public void testRaisesExceptionWhenUsedConcurrently() throws Exception {
    TAsyncClientManager mockClientManager = new TAsyncClientManager() {
      @Override
      public void call(TAsyncMethodCall method) throws TException {
        // do nothing
      }
    };

    Srv.AsyncClient c = new AsyncClient(null, mockClientManager, null);
    c.Janky(0, null);
    try {
      c.checkReady();
      fail("should have hit an exception");
    } catch (Exception e) {
      // awesome
    }
  }
}