@Test public void givenAlreadyAddedAspectWhenWithOtherAspectThenShouldRegister() { context.withAspect(AnAspect.class); context.withAspect(OtherAspect.class); verify(weaverMock).registerAspect(OtherAspect.class); }
@Test public void whenFromClassThenTheSourceIsSetToTheSameTypeAndName() { context.from(Date.class); CallSource source = context.getConfiguredCallSource(); assertSame(Date.class, source.getType()); assertEquals(Date.class.getName(), source.getName()); }
@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); }
@Test public void whenFromSourceThenTheSameSourceIsReturned() { CallSource specifiedSource = mock(CallSource.class); context.from(specifiedSource); assertSame(specifiedSource, context.getConfiguredCallSource()); }