RoleConfigurationManager { void readFromConfigurationRoles() { if (!ocelotConfigurationRoles.isUnsatisfied()) { Collection<String> get = ocelotConfigurationRoles.get(); logger.debug("Read '{}' option from Producer Collection<String> : '{}'.", Constants.Options.DASHBOARD_ROLES, get); roles.addAll(get); } }  void readDashboardRolesConfig(@Observes @Initialized(ApplicationScoped.class) ServletContext sc); Collection<String> getRoles();  }
@Test public void testReadFromConfigurationRoles() { System.out.println("readFromConfigurationRoles"); when(ocelotConfigurationRoles.isUnsatisfied()).thenReturn(Boolean.FALSE).thenReturn(Boolean.TRUE); when(ocelotConfigurationRoles.get()).thenReturn(Arrays.asList("R1", "R2")); instance.getRoles().clear(); instance.readFromConfigurationRoles(); assertThat(instance.getRoles()).hasSize(2); instance.getRoles().clear(); instance.readFromConfigurationRoles(); assertThat(instance.getRoles()).isEmpty(); }