mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/ccomm/TestAddressManagerServiceImpl.java
@Test
    public void testAddressAlreadyExist() throws CCommException
    {
        //create valid addr
        Address address = m_SUT.getOrCreateAddress("Base:things");
        
        // mock address to return true for matched props
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("prop", "things");
        when(m_FactoryServiceContext.getRegistry()).thenReturn(m_Registry);
        when(m_FactoryServiceContext.getRegistry().getObjectsByProductType(anyString())).thenReturn(m_RegistryObjects);
        when(address.equalProperties(props)).thenReturn(true);
        
        // This should be true as the address exists
        assertThat(m_SUT.checkAddressAlreadyExists("Base:things"), is(true));
        
        //verify
        verify(m_Translator, times(2)).getAddressPropsFromString("things");
    }
/**
     * Verify address already exists queries error if the address description passed is incomplete.
     */
Verify address already exists queries error if the address description passed is incomplete.
Verify address already exists queries error if the address description passed is incomplete .
@Test
    public void testAddressAlreadyExist() throws CCommException
    {
        Address address = m_SUT.getOrCreateAddress("Base:things");
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("prop", "things");
        when(m_FactoryServiceContext.getRegistry()).thenReturn(m_Registry);
        when(m_FactoryServiceContext.getRegistry().getObjectsByProductType(anyString())).thenReturn(m_RegistryObjects);
        when(address.equalProperties(props)).thenReturn(true);
        assertThat(m_SUT.checkAddressAlreadyExists("Base:things"), is(true));
        verify(m_Translator, times(2)).getAddressPropsFromString("things");
    }
@ Test public void testAddressAlreadyExist ( ) throws CCommException { Address address = m_SUT . getOrCreateAddress ( "Base:things" ) ; Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( "prop" , "things" ) ; when ( m_FactoryServiceContext . getRegistry ( ) ) . thenReturn ( m_Registry ) ; when ( m_FactoryServiceContext . getRegistry ( ) . getObjectsByProductType ( anyString ( ) ) ) . thenReturn ( m_RegistryObjects ) ; when ( address . equalProperties ( props ) ) . thenReturn ( true ) ; assertThat ( m_SUT . checkAddressAlreadyExists ( "Base:things" ) , is ( true ) ) ; verify ( m_Translator , times ( 2 ) ) . getAddressPropsFromString ( "things" ) ; }
Verify address already exists queries error if the address description passed is incomplete.
Verify address already exists queries error if the address description passed is incomplete .
//create valid addr // mock address to return true for matched props // This should be true as the address exists //verify