Пример #1
0
  @Test
  public void testInvoke() throws Exception {
    MethodDescriptor<? super PdefTestInterface, ?> method = method();
    assert method != null;

    PdefTestInterface object = mock(PdefTestInterface.class);
    method.invoke(object, new Object[] {1, 2});
    verify(object).method(1, 2);
  }
Пример #2
0
  @Test(expected = PdefTestException.class)
  public void testInvoke_exception() throws Exception {
    MethodDescriptor<? super PdefTestInterface, ?> method =
        PdefTestInterface.DESCRIPTOR.getMethod("exc0");
    assert method != null;

    PdefTestInterface object = mock(PdefTestInterface.class);
    doThrow(new PdefTestException()).when(object).exc0();

    method.invoke(object, null);
  }
Пример #3
0
  @Test
  public void testIndexPostTerminal() throws Exception {
    MethodDescriptor<?, ?> index = method();
    MethodDescriptor<?, ?> query = PdefTestInterface.DESCRIPTOR.getMethod("query");
    MethodDescriptor<?, ?> post = PdefTestInterface.DESCRIPTOR.getMethod("post");
    MethodDescriptor<?, ?> iface = PdefTestInterface.DESCRIPTOR.getMethod("interface0");

    assertTrue(index.isTerminal());
    assertFalse(index.isPost());

    assertTrue(query.isTerminal());
    assertFalse(query.isPost());

    assertTrue(post.isTerminal());
    assertTrue(post.isPost());

    assertFalse(iface.isTerminal());
    assertFalse(iface.isPost());
  }
Пример #4
0
 @Test
 public void testGetName() throws Exception {
   MethodDescriptor<?, ?> method = method();
   assertNotNull(method);
   assertEquals("method", method.getName());
 }