mil.dod.th.ose.config/test/mil/dod/th/ose/config/loading/impl/TestAddressTrackerCustomizer.java
@Test
    public void testAddingServiceException() throws IllegalArgumentException, IllegalStateException, FactoryException
    {
        AddressConfig config = new AddressConfig()
            .withAddressDescription(TEST_DESC)
            .withCreatePolicy(CreatePolicyEnum.FIRST_RUN);
        
        when(m_AddressManagerService.getOrCreateAddress(TEST_DESC)).thenThrow(
                new CCommException("problem", FormatProblem.ADDRESS_MISMATCH));

        AddressTrackerCustomizer sut =
                new AddressTrackerCustomizer(config, m_AddressManagerService, m_Log, m_EventAdmin);
        
        sut.addingService(m_ServiceReference);

        verify(m_AddressManagerService).getOrCreateAddress(TEST_DESC);
        verify(m_Log).log(eq(LogService.LOG_WARNING), Mockito.any(FactoryException.class), Mockito.anyString(), 
                Mockito.any());
    }
/**
     *  Verify error handling if an address cannot be created.
     */
Verify error handling if an address cannot be created.
Verify error handling if an address cannot be created .
@Test
    public void testAddingServiceException() throws IllegalArgumentException, IllegalStateException, FactoryException
    {
        AddressConfig config = new AddressConfig()
            .withAddressDescription(TEST_DESC)
            .withCreatePolicy(CreatePolicyEnum.FIRST_RUN);
        when(m_AddressManagerService.getOrCreateAddress(TEST_DESC)).thenThrow(
                new CCommException("problem", FormatProblem.ADDRESS_MISMATCH));
        AddressTrackerCustomizer sut =
                new AddressTrackerCustomizer(config, m_AddressManagerService, m_Log, m_EventAdmin);
        sut.addingService(m_ServiceReference);
        verify(m_AddressManagerService).getOrCreateAddress(TEST_DESC);
        verify(m_Log).log(eq(LogService.LOG_WARNING), Mockito.any(FactoryException.class), Mockito.anyString(), 
                Mockito.any());
    }
@ Test public void testAddingServiceException ( ) throws IllegalArgumentException , IllegalStateException , FactoryException { AddressConfig config = new AddressConfig ( ) . withAddressDescription ( TEST_DESC ) . withCreatePolicy ( CreatePolicyEnum . FIRST_RUN ) ; when ( m_AddressManagerService . getOrCreateAddress ( TEST_DESC ) ) . thenThrow ( new CCommException ( "problem" , FormatProblem . ADDRESS_MISMATCH ) ) ; AddressTrackerCustomizer sut = new AddressTrackerCustomizer ( config , m_AddressManagerService , m_Log , m_EventAdmin ) ; sut . addingService ( m_ServiceReference ) ; verify ( m_AddressManagerService ) . getOrCreateAddress ( TEST_DESC ) ; verify ( m_Log ) . log ( eq ( LogService . LOG_WARNING ) , Mockito . any ( FactoryException . class ) , Mockito . anyString ( ) , Mockito . any ( ) ) ; }
Verify error handling if an address cannot be created.
Verify error handling if an address cannot be created .