mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/asset/TestAssetDirectoryServiceImpl.java
@Test
    public void testGetAssetByTypeReturnsUnmodifiable() throws IllegalArgumentException, AssetException
    {
        Set<AssetInternal> set = new HashSet<>();
        set.add(mock(AssetInternal.class));
        when(m_Registry.getObjectsByProductType(PRODUCT_TYPE)).thenReturn(set);
        Set<Asset> assets = m_SUT.getAssetsByType(PRODUCT_TYPE);

        assertThat(assets.isEmpty(), is(false));
        
        try
        {
            assets.remove(assets.iterator().next());
            fail("Expected exception to be thrown upon modifying the set.");
        }
        catch(Exception e)
        {
            // do nothing
        }
    }
/**
     * Verify get assets by type returns and unmodifiable set.
     */
Verify get assets by type returns and unmodifiable set.
Verify get assets by type returns and unmodifiable set .
@Test
    public void testGetAssetByTypeReturnsUnmodifiable() throws IllegalArgumentException, AssetException
    {
        Set<AssetInternal> set = new HashSet<>();
        set.add(mock(AssetInternal.class));
        when(m_Registry.getObjectsByProductType(PRODUCT_TYPE)).thenReturn(set);
        Set<Asset> assets = m_SUT.getAssetsByType(PRODUCT_TYPE);
        assertThat(assets.isEmpty(), is(false));
        try
        {
            assets.remove(assets.iterator().next());
            fail("Expected exception to be thrown upon modifying the set.");
        }
        catch(Exception e)
        {
        }
    }
@ Test public void testGetAssetByTypeReturnsUnmodifiable ( ) throws IllegalArgumentException , AssetException { Set < AssetInternal > set = new HashSet < > ( ) ; set . add ( mock ( AssetInternal . class ) ) ; when ( m_Registry . getObjectsByProductType ( PRODUCT_TYPE ) ) . thenReturn ( set ) ; Set < Asset > assets = m_SUT . getAssetsByType ( PRODUCT_TYPE ) ; assertThat ( assets . isEmpty ( ) , is ( false ) ) ; try { assets . remove ( assets . iterator ( ) . next ( ) ) ; fail ( "Expected exception to be thrown upon modifying the set." ) ; } catch ( Exception e ) { } }
Verify get assets by type returns and unmodifiable set.
Verify get assets by type returns and unmodifiable set .
// do nothing