Package org.constretto.model

Examples of org.constretto.model.Resource


*/
public class PropertiesStoreInputStreamCloseTest {

    @Test
    public void verifyInputStreamIsClosed() throws IOException {
        Resource resource = mock(Resource.class);
        InputStream is = mock(InputStream.class);
        when(resource.exists()).thenReturn(true);
        when(resource.getInputStream()).thenReturn(is);
        PropertiesStore ps = new PropertiesStore();
        ps.addResource(resource);
        verify(is).close();
    }
View Full Code Here


    @Test
    public void verifyInputStreamIsClosedOnException() throws IOException {
        InputStream is = null;
        try {
            Resource resource = mock(Resource.class);
            is = mock(InputStream.class, new ThrowsException(new IOException()));
            when(resource.exists()).thenReturn(true);
            when(resource.getInputStream()).thenReturn(is);
            PropertiesStore ps = new PropertiesStore();
            ps.addResource(resource);
            Assert.fail();;
        } catch (ConstrettoException ce) {
            verify(is).close();
View Full Code Here

*/
public class PropertiesStoreTest extends AbstractConfigurationStoreTest {

    @Override
    protected ConfigurationStore getStore() {
        Resource props = new ClassPathResource("test.properties");
        return new PropertiesStore().addResource(props);
    }
View Full Code Here

TOP

Related Classes of org.constretto.model.Resource

Copyright © 2018 www.massapicom. 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.