Search in sources :

Example 6 with NoProviderFoundException

use of com.att.cdp.exceptions.NoProviderFoundException in project AJSC by att.

the class TestContextFactory method testWithPropertiesConfiguration.

/**
 * Tests that we can use a properties object to configure the context.
 */
@Test
public void testWithPropertiesConfiguration() {
    String dummyPropertyName = "dummyPropertyName";
    String dummyPropertyValue = "dummyPropertyValue";
    try {
        Properties properties = new Properties();
        properties.setProperty(dummyPropertyName, dummyPropertyValue);
        Context context = ContextFactory.getContext(ProviderName, properties);
        assertNotNull(context);
        assertTrue(context instanceof DummyProviderContext);
        assertNotNull(context.getProperties());
        assertTrue(context.getProperties().containsKey(dummyPropertyName));
        assertEquals(dummyPropertyValue, context.getProperties().getProperty(dummyPropertyName));
    } catch (NoProviderFoundException e) {
        fail("We were supposed to find the TestProvider!");
    }
}
Also used : DummyProviderContext(com.att.cdp.zones.test.DummyProviderContext) NoProviderFoundException(com.att.cdp.exceptions.NoProviderFoundException) Properties(java.util.Properties) DummyProviderContext(com.att.cdp.zones.test.DummyProviderContext) Test(org.junit.Test)

Aggregations

NoProviderFoundException (com.att.cdp.exceptions.NoProviderFoundException)6 DummyProviderContext (com.att.cdp.zones.test.DummyProviderContext)4 Test (org.junit.Test)4 Properties (java.util.Properties)1 ServiceConfigurationError (java.util.ServiceConfigurationError)1