@Test public void givenAlreadyAddedAspectWhenWithOtherAspectThenShouldRegister() { context.withAspect(AnAspect.class); context.withAspect(OtherAspect.class); verify(weaverMock).registerAspect(OtherAspect.class); }
@Test public void whenWithAspectMultipleTimesThenShouldNotResetAndShouldRegisterEveryAspect() { context.withAspect(AnAspect.class); context.withAspect(OtherAspect.class); verify(weaverMock, times(2)).registerAspect((Class<?>) anyObject()); verifyNoMoreInteractions(weaverMock); }
@Test public void whenWithAspectShouldRegisterTheAspectOnTheWeaver() { Class<?> theAspect = AnAspect.class; context.withAspect(theAspect); verify(weaverMock).registerAspect(theAspect); }