context = contextManager.findContextOfType(contextType);
/******************************************************************************************************************* * ******************************************************************************************************************/ @Test(dataProvider = "ownersAndRoleImplementations") public void must_correctly_find_roles (final @Nonnull Object owner, final @Nonnull Class<?> roleClass, final @Nonnull List<?> expectedRoles) throws NotFoundException { // given when(contextManager.findContextOfType(eq(Context1.class))).thenThrow(new NotFoundException()); when(contextManager.findContextOfType(eq(Context2.class))).thenReturn(context2); final UnderTest underTest = new UnderTest(); registerMockRoles(underTest); underTest.registerBean(bean1); underTest.registerBean(bean2); underTest.scan(asList(RI1A.class, RI1B.class, RI1C.class, RI2A.class, RI2B.class, RI2C.class, RI3A.class, RI3B.class, RI3C.class)); // when final List<?> actualRoles = underTest.findRoles(owner, roleClass); // then final String s = String.format("owner: %s role: %s", shortId(owner), shortName(roleClass)); assertListEquals(s, actualRoles, expectedRoles); }