Package org.aeonbits.owner

Examples of org.aeonbits.owner.PropertiesManagerForTest.load()


    @Test
    public void testListPrintStream() throws IOException {
        ByteArrayOutputStream expected = new ByteArrayOutputStream();
        PropertiesManagerForTest manager =
                new PropertiesManagerForTest(AccessibleConfig.class, new Properties(), scheduler, expander, loaders);
        manager.load().list(new PrintStream(expected, true));

        AccessibleConfig config = ConfigFactory.create(AccessibleConfig.class);
        ByteArrayOutputStream result = new ByteArrayOutputStream();
        config.list(new PrintStream(result, true));
View Full Code Here


    @Test
    public void testListPrintWriter() throws IOException {
        StringWriter expected = new StringWriter();
        PropertiesManagerForTest manager =
                new PropertiesManagerForTest(AccessibleConfig.class, new Properties(), scheduler, expander, loaders);
        manager.load().list(new PrintWriter(expected, true));

        AccessibleConfig config = ConfigFactory.create(AccessibleConfig.class);
        StringWriter result = new StringWriter();
        config.list(new PrintWriter(result, true));
View Full Code Here

    @Test
    public void shouldLoadURLFromSpecifiedSource() throws IOException {
        PropertiesManagerForTest manager =
                new PropertiesManagerForTest(SampleConfigWithSource.class, new Properties(),
                        scheduler, expander, loaders);
        manager.load();
        verify(loaders, times(1)).findLoader(any(URL.class));
        verify(loaders, times(1)).findLoader(argThat(urlMatches("org/aeonbits/owner/FooBar.properties")));
    }

    @Test
View Full Code Here

    @Test
    public void shouldReturnTheResourceForAClass() throws IOException {
        PropertiesManagerForTest manager =
                new PropertiesManagerForTest(SampleConfig.class, new Properties(), scheduler, expander, loaders);

        manager.load();
       
        verify(loaders, times(1)).findLoader(any(URL.class));
        verify(loaders, times(1)).findLoader(argThat(urlMatches(
                "org/aeonbits/owner/loadstrategies/DefaultLoadStrategyTest$SampleConfig.properties")));
    }
View Full Code Here

    @Test
    public void shouldReturnThePropertiesForTheClass() {
        PropertiesManagerForTest manager =
                new PropertiesManagerForTest(SampleConfig.class, new Properties(), scheduler, expander, loaders);
        Properties props = manager.load();
        assertNotNull(props);
        assertEquals("testValue", props.getProperty("testKey"));
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.