/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieveList(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveListNotFound() { assertEquals( Collections.emptyList(), configurationSource.retrieveList("nolistKey", String.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieveList(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveList() { assertEquals( Arrays.asList("testA", "testB", "testC"), configurationSource.retrieveList("key2", String.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieveList(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveListDirectHit() { assertEquals(Arrays.asList("test1"), configurationSource.retrieveList("key1", String.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test(expected = ConfigurationException.class) public void testRetrieveUnknown() { configurationSource.retrieve("floatKey", URL.class); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveNotFound() { assertNull(configurationSource.retrieve("noKey", String.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#isAvailable(java.lang.Class)}. */ @Test(expected = ConfigurationException.class) public void testIsAvailableClassOfQ() { configurationSource.isAvailable(String.class); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveInteger() { assertEquals(Integer.valueOf(256), configurationSource.retrieve("intKey", Integer.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveUUID() { assertEquals( UUID.fromString("a65a0ab0-285b-11e2-81c1-0800200c9a66"), configurationSource.retrieve("uuidKey", UUID.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveEnum() { assertEquals(TimeUnit.DAYS, configurationSource.retrieve("enumKey", TimeUnit.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveDouble() { assertEquals( Double.valueOf(8589897474565965547558.69d), configurationSource.retrieve("doubleKey", Double.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveBoolean() { assertEquals(Boolean.TRUE, configurationSource.retrieve("booleanKey", Boolean.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveFloat() { assertEquals(Float.valueOf(85.69f), configurationSource.retrieve("floatKey", Float.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveShort() { assertEquals(Short.valueOf((short) 223), configurationSource.retrieve("shortKey", Short.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveLong() { assertEquals(Long.valueOf(45678912312L), configurationSource.retrieve("longKey", Long.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#isAvailable(java.lang.String)}. */ @Test public void testIsAvailableString() { assertTrue(configurationSource.isAvailable("key1")); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveURI() throws Exception { assertEquals( new URI("http://example.org/example"), configurationSource.retrieve("uriKey", URI.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#isAvailable(java.lang.String)}. */ @Test public void testIsNotAvailableString() { assertFalse(configurationSource.isAvailable("key1.not")); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveLocale() throws Exception { assertEquals(new Locale("en"), configurationSource.retrieve("localeKey", Locale.class)); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.Class)}. */ @Test(expected = ConfigurationException.class) public void testRetrieveClassOfT() { configurationSource.retrieve(String.class); }
/** * Test method for {@link * org.brekka.stillingar.core.properties.PropertiesConfigurationSource#retrieve(java.lang.String, * java.lang.Class)}. */ @Test public void testRetrieveString() { assertEquals("test1", configurationSource.retrieve("key1", String.class)); }