mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/asset/TestAssetDirectoryServiceImpl.java
@SuppressWarnings("unchecked")
    private AssetInternal mockCreateAssetSequence() throws IllegalArgumentException, FactoryException, 
        FactoryObjectInformationException, ClassNotFoundException
    {
        final AssetInternal mockAsset = mock(AssetInternal.class);
        
        FactoryInternal descriptor = mock(FactoryInternal.class);
        final UUID uuid = UUID.randomUUID();
        when(mockAsset.getUuid()).thenReturn(uuid);
        when(descriptor.getProductType()).thenReturn(PRODUCT_TYPE);
        when(mockAsset.getFactory()).thenReturn(descriptor);
        when(mockAsset.getName()).thenReturn("Ditka");

        AssetAttributes attributes = mock(AssetAttributes.class);
        when(attributes.activateOnStartup()).thenReturn(new Boolean(false));
        
        when(mockAsset.getConfig()).thenReturn(attributes);
        when(mockAsset.getActiveStatus()).thenReturn(AssetActiveStatus.DEACTIVATED);
        
        when(m_Registry.createNewObject(eq(m_AssetFactory), Mockito.any(String.class), 
                Mockito.any(Map.class))).thenReturn(mockAsset);
        when(m_Registry.getObjectByUuid(uuid)).thenReturn(mockAsset);
        
        Set<AssetInternal> objSet = new HashSet<>();
        objSet.add(mockAsset);
        when(m_Registry.getObjects()).thenReturn(objSet);
        
        doAnswer(new Answer<Void>()
        {
            @Override
            public Void answer(InvocationOnMock invocation) throws Throwable
            {
                m_EventAdmin.postEvent(new Event((String)invocation.getArguments()[0], 
                        (Map<String, Object>)invocation.getArguments()[1]));
                return null;
            }
        }).when(mockAsset).postEvent(Mockito.anyString(), Mockito.anyMap());
        
        return mockAsset;
    }
/**
     * Method which creates a mock instance of an asset and provides stubbing to provide 
     * @return
     *  the mocked asset impl
     */
Method which creates a mock instance of an asset and provides stubbing to provide
@return
the mocked asset impl
Method which creates a mock instance of an asset and provides stubbing to provide @return the mocked asset impl
@SuppressWarnings("unchecked")
    private AssetInternal mockCreateAssetSequence() throws IllegalArgumentException, FactoryException, 
        FactoryObjectInformationException, ClassNotFoundException
    {
        final AssetInternal mockAsset = mock(AssetInternal.class);
        FactoryInternal descriptor = mock(FactoryInternal.class);
        final UUID uuid = UUID.randomUUID();
        when(mockAsset.getUuid()).thenReturn(uuid);
        when(descriptor.getProductType()).thenReturn(PRODUCT_TYPE);
        when(mockAsset.getFactory()).thenReturn(descriptor);
        when(mockAsset.getName()).thenReturn("Ditka");
        AssetAttributes attributes = mock(AssetAttributes.class);
        when(attributes.activateOnStartup()).thenReturn(new Boolean(false));
        when(mockAsset.getConfig()).thenReturn(attributes);
        when(mockAsset.getActiveStatus()).thenReturn(AssetActiveStatus.DEACTIVATED);
        when(m_Registry.createNewObject(eq(m_AssetFactory), Mockito.any(String.class), 
                Mockito.any(Map.class))).thenReturn(mockAsset);
        when(m_Registry.getObjectByUuid(uuid)).thenReturn(mockAsset);
        Set<AssetInternal> objSet = new HashSet<>();
        objSet.add(mockAsset);
        when(m_Registry.getObjects()).thenReturn(objSet);
        doAnswer(new Answer<Void>()
        {
            @Override
            public Void answer(InvocationOnMock invocation) throws Throwable
            {
                m_EventAdmin.postEvent(new Event((String)invocation.getArguments()[0], 
                        (Map<String, Object>)invocation.getArguments()[1]));
                return null;
            }
        }).when(mockAsset).postEvent(Mockito.anyString(), Mockito.anyMap());
        return mockAsset;
    }
@ SuppressWarnings ( "unchecked" ) private AssetInternal mockCreateAssetSequence ( ) throws IllegalArgumentException , FactoryException , FactoryObjectInformationException , ClassNotFoundException { final AssetInternal mockAsset = mock ( AssetInternal . class ) ; FactoryInternal descriptor = mock ( FactoryInternal . class ) ; final UUID uuid = UUID . randomUUID ( ) ; when ( mockAsset . getUuid ( ) ) . thenReturn ( uuid ) ; when ( descriptor . getProductType ( ) ) . thenReturn ( PRODUCT_TYPE ) ; when ( mockAsset . getFactory ( ) ) . thenReturn ( descriptor ) ; when ( mockAsset . getName ( ) ) . thenReturn ( "Ditka" ) ; AssetAttributes attributes = mock ( AssetAttributes . class ) ; when ( attributes . activateOnStartup ( ) ) . thenReturn ( new Boolean ( false ) ) ; when ( mockAsset . getConfig ( ) ) . thenReturn ( attributes ) ; when ( mockAsset . getActiveStatus ( ) ) . thenReturn ( AssetActiveStatus . DEACTIVATED ) ; when ( m_Registry . createNewObject ( eq ( m_AssetFactory ) , Mockito . any ( String . class ) , Mockito . any ( Map . class ) ) ) . thenReturn ( mockAsset ) ; when ( m_Registry . getObjectByUuid ( uuid ) ) . thenReturn ( mockAsset ) ; Set < AssetInternal > objSet = new HashSet < > ( ) ; objSet . add ( mockAsset ) ; when ( m_Registry . getObjects ( ) ) . thenReturn ( objSet ) ; doAnswer ( new Answer < Void > ( ) { @ Override public Void answer ( InvocationOnMock invocation ) throws Throwable { m_EventAdmin . postEvent ( new Event ( ( String ) invocation . getArguments ( ) [ 0 ] , ( Map < String , Object > ) invocation . getArguments ( ) [ 1 ] ) ) ; return null ; } } ) . when ( mockAsset ) . postEvent ( Mockito . anyString ( ) , Mockito . anyMap ( ) ) ; return mockAsset ; }
Method which creates a mock instance of an asset and provides stubbing to provide
 @return
  the mocked asset impl
Method which creates a mock instance of an asset and provides stubbing to provide @return the mocked asset impl