mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/TestFactoryServiceUtils.java
@Test
    public void testGetFactoryConfiguration_MultipleConfigs() throws Exception
    {
        Configuration config1 = mock(Configuration.class);
        Configuration config2 = mock(Configuration.class);
        when(configAdmin.listConfigurations("(service.pid=some-pid)"))
            .thenReturn(new Configuration[] {config1, config2});
        
        try
        {
            FactoryServiceUtils.getFactoryConfiguration(configAdmin, "some-pid");
            fail("Expecting exception as multiple configs are returned");
        }
        catch (IllegalStateException e) { }
    }
/**
     * Verify method throws exception if multiple configs are returned.
     */
Verify method throws exception if multiple configs are returned.
Verify method throws exception if multiple configs are returned .
@Test
    public void testGetFactoryConfiguration_MultipleConfigs() throws Exception
    {
        Configuration config1 = mock(Configuration.class);
        Configuration config2 = mock(Configuration.class);
        when(configAdmin.listConfigurations("(service.pid=some-pid)"))
            .thenReturn(new Configuration[] {config1, config2});
        try
        {
            FactoryServiceUtils.getFactoryConfiguration(configAdmin, "some-pid");
            fail("Expecting exception as multiple configs are returned");
        }
        catch (IllegalStateException e) { }
    }
@ Test public void testGetFactoryConfiguration_MultipleConfigs ( ) throws Exception { Configuration config1 = mock ( Configuration . class ) ; Configuration config2 = mock ( Configuration . class ) ; when ( configAdmin . listConfigurations ( "(service.pid=some-pid)" ) ) . thenReturn ( new Configuration [ ] { config1 , config2 } ) ; try { FactoryServiceUtils . getFactoryConfiguration ( configAdmin , "some-pid" ) ; fail ( "Expecting exception as multiple configs are returned" ) ; } catch ( IllegalStateException e ) { } }
Verify method throws exception if multiple configs are returned.
Verify method throws exception if multiple configs are returned .