mil.dod.th.ose.datastream/test/mil/dod/th/ose/datastream/TestDataStreamServiceImpl.java
@Test
    public void testGetStreamProfileByUuid() throws InvalidSyntaxException
    {
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(DataStreamServiceConfig.CONFIG_PROP_MULTICAST_HOST, "225.1.2.3");
        props.put(DataStreamServiceConfig.CONFIG_PROP_START_PORT, 5004);
        
        m_SUT.activate(Collections.unmodifiableMap(props), m_BundleContext);        
        
        when(m_Registry.getObjectByUuid((UUID)isNull())).thenThrow(new IllegalArgumentException("UUID cannot be null"));
        
        try
        {
            m_SUT.getStreamProfile(null);
            fail("Expected exception from getStreamProfile");
        }
        catch (IllegalArgumentException e)
        {
           
        }
        
        StreamProfileInternal internal = mock(StreamProfileInternal.class);
        UUID uuid = UUID.randomUUID();        
        when(m_Registry.getObjectByUuid(uuid)).thenReturn(internal);
        StreamProfile retrievedStreamProfile = m_SUT.getStreamProfile(uuid);
        assertThat(retrievedStreamProfile, notNullValue());
    }
/**
     * Verify that requesting a stream profile by UUID throws an exception if the UUID is null.
     * Verify the correct stream profile is returned if the UUID is not null.
     */
Verify that requesting a stream profile by UUID throws an exception if the UUID is null.
Verify the correct stream profile is returned if the UUID is not null.
Verify that requesting a stream profile by UUID throws an exception if the UUID is null . Verify the correct stream profile is returned if the UUID is not null .
@Test
    public void testGetStreamProfileByUuid() throws InvalidSyntaxException
    {
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(DataStreamServiceConfig.CONFIG_PROP_MULTICAST_HOST, "225.1.2.3");
        props.put(DataStreamServiceConfig.CONFIG_PROP_START_PORT, 5004);
        m_SUT.activate(Collections.unmodifiableMap(props), m_BundleContext);        
        when(m_Registry.getObjectByUuid((UUID)isNull())).thenThrow(new IllegalArgumentException("UUID cannot be null"));
        try
        {
            m_SUT.getStreamProfile(null);
            fail("Expected exception from getStreamProfile");
        }
        catch (IllegalArgumentException e)
        {
        }
        StreamProfileInternal internal = mock(StreamProfileInternal.class);
        UUID uuid = UUID.randomUUID();        
        when(m_Registry.getObjectByUuid(uuid)).thenReturn(internal);
        StreamProfile retrievedStreamProfile = m_SUT.getStreamProfile(uuid);
        assertThat(retrievedStreamProfile, notNullValue());
    }
@ Test public void testGetStreamProfileByUuid ( ) throws InvalidSyntaxException { Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( DataStreamServiceConfig . CONFIG_PROP_MULTICAST_HOST , "225.1.2.3" ) ; props . put ( DataStreamServiceConfig . CONFIG_PROP_START_PORT , 5004 ) ; m_SUT . activate ( Collections . unmodifiableMap ( props ) , m_BundleContext ) ; when ( m_Registry . getObjectByUuid ( ( UUID ) isNull ( ) ) ) . thenThrow ( new IllegalArgumentException ( "UUID cannot be null" ) ) ; try { m_SUT . getStreamProfile ( null ) ; fail ( "Expected exception from getStreamProfile" ) ; } catch ( IllegalArgumentException e ) { } StreamProfileInternal internal = mock ( StreamProfileInternal . class ) ; UUID uuid = UUID . randomUUID ( ) ; when ( m_Registry . getObjectByUuid ( uuid ) ) . thenReturn ( internal ) ; StreamProfile retrievedStreamProfile = m_SUT . getStreamProfile ( uuid ) ; assertThat ( retrievedStreamProfile , notNullValue ( ) ) ; }
Verify that requesting a stream profile by UUID throws an exception if the UUID is null.
Verify that requesting a stream profile by UUID throws an exception if the UUID is null .