示例#1
0
 public void testCreate() {
   GroupManager groupManager = mock(GroupManager.class);
   String name = groupManager.getClass().getSimpleName();
   when(_factory.createInstance(_attributes)).thenReturn(groupManager);
   GroupProviderRecoverer groupProviderRecoverer =
       new GroupProviderRecoverer(_groupManagerServiceLoader);
   GroupProvider groupProvider = groupProviderRecoverer.create(null, _configurationEntry, _broker);
   assertNotNull("Null group provider", groupProvider);
   assertEquals("Unexpected name", name, groupProvider.getName());
   assertEquals("Unexpected ID", _id, groupProvider.getId());
 }
示例#2
0
  public void testCreateThrowsExceptionWhenNoGroupManagerIsCreated() {
    when(_factory.createInstance(_attributes)).thenReturn(null);

    GroupProviderRecoverer groupProviderRecoverer =
        new GroupProviderRecoverer(_groupManagerServiceLoader);
    try {
      groupProviderRecoverer.create(null, _configurationEntry, _broker);
      fail("Configuration exception should be thrown when group manager is not created");
    } catch (IllegalConfigurationException e) {
      // pass
    }
  }