コード例 #1
0
  @Test
  public void givenAlreadyAddedAspectWhenWithOtherAspectThenShouldRegister() {
    context.withAspect(AnAspect.class);
    context.withAspect(OtherAspect.class);

    verify(weaverMock).registerAspect(OtherAspect.class);
  }
コード例 #2
0
  @Test
  public void whenFromClassThenTheSourceIsSetToTheSameTypeAndName() {
    context.from(Date.class);
    CallSource source = context.getConfiguredCallSource();

    assertSame(Date.class, source.getType());
    assertEquals(Date.class.getName(), source.getName());
  }
コード例 #3
0
  @Test
  public void whenWithAspectMultipleTimesThenShouldNotResetAndShouldRegisterEveryAspect() {
    context.withAspect(AnAspect.class);
    context.withAspect(OtherAspect.class);

    verify(weaverMock, times(2)).registerAspect((Class<?>) anyObject());
    verifyNoMoreInteractions(weaverMock);
  }
コード例 #4
0
  @Test
  public void whenWithAspectShouldRegisterTheAspectOnTheWeaver() {
    Class<?> theAspect = AnAspect.class;
    context.withAspect(theAspect);

    verify(weaverMock).registerAspect(theAspect);
  }
コード例 #5
0
 @Test
 public void whenFromSourceThenTheSameSourceIsReturned() {
   CallSource specifiedSource = mock(CallSource.class);
   context.from(specifiedSource);
   assertSame(specifiedSource, context.getConfiguredCallSource());
 }