Esempio n. 1
0
 @Mock
 public int computeX(Invocation inv, int a, int b) {
   inputValues.add(a);
   inputValues.add(b);
   int x = inv.proceed();
   outputValues.add(x);
   return x;
 }
Esempio n. 2
0
    @Mock
    public int computeX(Invocation inv, int a, int b) {
      Integer x;

      try {
        x = inv.proceed();
        return x;
      } finally {
        // Statements to be executed on exit would be here.
        //noinspection UnusedAssignment
        x = a + b;
        values.add(x);
      }
    }
Esempio n. 3
0
 @Mock
 public String getConfig(Invocation inv) {
   String config = inv.proceed();
   assertNull(config);
   return "test";
 }
Esempio n. 4
0
 @Mock(minInvocations = 1, maxInvocations = 3)
 public int computeX(Invocation inv, int a, int b) {
   assertTrue(a + b >= 0);
   assertNotNull(inv.getInvokedInstance());
   return a - b;
 }
Esempio n. 5
0
 @Mock(invocations = 1)
 public void $init(Invocation inv, String config) {
   assertNotNull(inv.getInvokedInstance());
   assertEquals("config", config);
 }
Esempio n. 6
0
 @Mock
 public int computeX(Invocation inv, int a, int b) {
   values.add(a + b);
   return inv.proceed();
 }