mil.dod.th.ose.utils/test/mil/dod/th/ose/utils/impl/TestPropertyRetrieverImpl.java
@Test
    public void testGetProperty() throws IOException
    {
        //URL connection and input stream mocking
        URL url = PowerMockito.mock(URL.class);
        URLConnection connection = PowerMockito.mock(URLConnection.class);
        InputStream is = mock(InputStream.class);
        when(url.openConnection()).thenReturn(connection);
        when(connection.getInputStream()).thenReturn(is);
        
        //pass the url
        Properties props = m_SUT.getPropertiesFromUrl(url);
        
        //verify that properties object is not null
        assertThat(props, is(notNullValue()));
        
        //verify that the input stream is closed
        verify(is).close();
    }
/**
     * Test that a given URL can be connected to via a URL connection, and that a properties object is returned.
     * Verify that a {@link Properties} object is returned.
     * Verify that the input stream is closed after properties are loaded.
     */
Test that a given URL can be connected to via a URL connection, and that a properties object is returned.
Verify that a  Properties object is returned.
Verify that the input stream is closed after properties are loaded.
Test that a given URL can be connected to via a URL connection and that a properties object is returned . Verify that a Properties object is returned . Verify that the input stream is closed after properties are loaded .
@Test
    public void testGetProperty() throws IOException
    {
        URL url = PowerMockito.mock(URL.class);
        URLConnection connection = PowerMockito.mock(URLConnection.class);
        InputStream is = mock(InputStream.class);
        when(url.openConnection()).thenReturn(connection);
        when(connection.getInputStream()).thenReturn(is);
        Properties props = m_SUT.getPropertiesFromUrl(url);
        assertThat(props, is(notNullValue()));
        verify(is).close();
    }
@ Test public void testGetProperty ( ) throws IOException { URL url = PowerMockito . mock ( URL . class ) ; URLConnection connection = PowerMockito . mock ( URLConnection . class ) ; InputStream is = mock ( InputStream . class ) ; when ( url . openConnection ( ) ) . thenReturn ( connection ) ; when ( connection . getInputStream ( ) ) . thenReturn ( is ) ; Properties props = m_SUT . getPropertiesFromUrl ( url ) ; assertThat ( props , is ( notNullValue ( ) ) ) ; verify ( is ) . close ( ) ; }
Test that a given URL can be connected to via a URL connection, and that a properties object is returned.
Test that a given URL can be connected to via a URL connection and that a properties object is returned .
//URL connection and input stream mocking //pass the url //verify that properties object is not null //verify that the input stream is closed