Example #1
0
  @Test
  public void afterAdvice() {
    OnExitTracingAspect aspect = new OnExitTracingAspect();

    ServiceB b = new ServiceB("test");

    assertEquals(3, b.computeX(1, 2));
    assertEquals(5, b.computeX(2, 3));
    assertEquals(-10, b.computeX(0, -10));
    assertEquals(asList(3, 5, -10), aspect.values);
  }
Example #2
0
  @Test
  public void aroundAdvice() {
    TracingAspect aspect = new TracingAspect();

    ServiceB b = new ServiceB("test");

    assertEquals(3, b.computeX(1, 2));
    assertEquals(5, b.computeX(2, 3));
    assertEquals(-10, b.computeX(0, -10));
    assertEquals(asList(1, 2, 2, 3, 0, -10), aspect.inputValues);
    assertEquals(asList(3, 5, -10), aspect.outputValues);
  }