mil.dod.th.ose.controller/test/mil/dod/th/ose/controller/impl/TestTerraHarvestControllerImpl.java
@Test
    public void testBuildInfoProxy() throws FileNotFoundException
    {
        ThoseVersionProvider versionProvider = mock(ThoseVersionProvider.class);
        when(versionProvider.getVersion()).thenReturn("1.0");
        m_SUT.setThoseVersionProvider(versionProvider);
        
        TerraHarvestControllerProxy proxy = mock(TerraHarvestControllerProxy.class);
        // bind proxy, then unbind
        m_SUT.setProxy(proxy);
        m_SUT.setProxy(null);
        
        m_SUT.getBuildInfo();
        
        // verify that proxy is never called on since it has been unbound
        verify(proxy, never()).getBuildInfo();
        
        m_SUT.setProxy(proxy);
        
        m_SUT.getBuildInfo();
        
        // verify that proxy is never called on since capabilities say not to
        verify(proxy, never()).getBuildInfo();
        
        // make sure if no element if provided (null value), treated as false
        when(m_MockCaps.isBuildInfoOverridden()).thenReturn(null);
        
        m_SUT.getBuildInfo();
        
        // verify that proxy is never called on since capabilities are set to defaults
        verify(proxy, never()).getBuildInfo();
        
        // mock capabilities
        when(m_MockCaps.isBuildInfoOverridden()).thenReturn(true);
        
        // mock proxy
        when(proxy.getBuildInfo()).thenReturn(
                ImmutableMap.<String, String>builder().put("proxy-key", "proxy-value").build());
        
        assertThat(m_SUT.getBuildInfo(), hasEntry("proxy-key", "proxy-value"));
    }
/**
     * Verify the proxy method is called for build info if capability is set and proxy is available
     */
Verify the proxy method is called for build info if capability is set and proxy is available
Verify the proxy method is called for build info if capability is set and proxy is available
@Test
    public void testBuildInfoProxy() throws FileNotFoundException
    {
        ThoseVersionProvider versionProvider = mock(ThoseVersionProvider.class);
        when(versionProvider.getVersion()).thenReturn("1.0");
        m_SUT.setThoseVersionProvider(versionProvider);
        TerraHarvestControllerProxy proxy = mock(TerraHarvestControllerProxy.class);
        m_SUT.setProxy(proxy);
        m_SUT.setProxy(null);
        m_SUT.getBuildInfo();
        verify(proxy, never()).getBuildInfo();
        m_SUT.setProxy(proxy);
        m_SUT.getBuildInfo();
        verify(proxy, never()).getBuildInfo();
        when(m_MockCaps.isBuildInfoOverridden()).thenReturn(null);
        m_SUT.getBuildInfo();
        verify(proxy, never()).getBuildInfo();
        when(m_MockCaps.isBuildInfoOverridden()).thenReturn(true);
        when(proxy.getBuildInfo()).thenReturn(
                ImmutableMap.<String, String>builder().put("proxy-key", "proxy-value").build());
        assertThat(m_SUT.getBuildInfo(), hasEntry("proxy-key", "proxy-value"));
    }
@ Test public void testBuildInfoProxy ( ) throws FileNotFoundException { ThoseVersionProvider versionProvider = mock ( ThoseVersionProvider . class ) ; when ( versionProvider . getVersion ( ) ) . thenReturn ( "1.0" ) ; m_SUT . setThoseVersionProvider ( versionProvider ) ; TerraHarvestControllerProxy proxy = mock ( TerraHarvestControllerProxy . class ) ; m_SUT . setProxy ( proxy ) ; m_SUT . setProxy ( null ) ; m_SUT . getBuildInfo ( ) ; verify ( proxy , never ( ) ) . getBuildInfo ( ) ; m_SUT . setProxy ( proxy ) ; m_SUT . getBuildInfo ( ) ; verify ( proxy , never ( ) ) . getBuildInfo ( ) ; when ( m_MockCaps . isBuildInfoOverridden ( ) ) . thenReturn ( null ) ; m_SUT . getBuildInfo ( ) ; verify ( proxy , never ( ) ) . getBuildInfo ( ) ; when ( m_MockCaps . isBuildInfoOverridden ( ) ) . thenReturn ( true ) ; when ( proxy . getBuildInfo ( ) ) . thenReturn ( ImmutableMap . < String , String > builder ( ) . put ( "proxy-key" , "proxy-value" ) . build ( ) ) ; assertThat ( m_SUT . getBuildInfo ( ) , hasEntry ( "proxy-key" , "proxy-value" ) ) ; }
Verify the proxy method is called for build info if capability is set and proxy is available
Verify the proxy method is called for build info if capability is set and proxy is available
// bind proxy, then unbind // verify that proxy is never called on since it has been unbound // verify that proxy is never called on since capabilities say not to // make sure if no element if provided (null value), treated as false // verify that proxy is never called on since capabilities are set to defaults // mock capabilities // mock proxy