示例#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);
  }