mil.dod.th.ose.gui.remote.encryption/test/mil/dod/th/ose/gui/remotesystemencryption/TestEncryptionTypeManagerImpl.java
@Test
    public void testEncryptionResponseMsgKnownSystemAndChangedType()
    {
        int controllerId = 123;
        
        when(m_RemoteSystemEncryption.getEncryptType(controllerId)).thenReturn(EncryptType.AES_ECDH_ECDSA);
        
        //mock encryption response for new controller
        Event event = mockEncryptionTypeResponse(controllerId, EncryptType.NONE);
        m_EncryptionInfoEventHelper.handleEvent(event);
        
        ArgumentCaptor<Event> captor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(captor.capture());
        
      //assert that first encryption type updated event is posted
        String topic = captor.getAllValues().get(0).getTopic();
        String type = (String)captor.getAllValues().get(0).getProperty(ControllerEncryptionConstants.
                EVENT_PROP_ENCRYPTION_TYPE);
        int systemId = (Integer)captor.getAllValues().get(0).getProperty(SharedPropertyConstants.
                EVENT_PROP_CONTROLLER_ID);
        assertThat(topic, is(ControllerEncryptionConstants.TOPIC_CONTROLLER_ENCRYPTION_TYPE_UPDATED));
        assertThat(EncryptType.valueOf(type), is(EncryptType.NONE));
        assertThat(systemId, is(controllerId));
        
        verify(m_RemoteSystemEncryption).addEncryptionTypeForSystem(controllerId, EncryptType.NONE);
    }
/**
     * Verify that an encryption type response for an known system that has changed its encryption type
     * generates an encrypt type updated event and the entry is saved to the remote system encryption service.
     */
Verify that an encryption type response for an known system that has changed its encryption type
generates an encrypt type updated event and the entry is saved to the remote system encryption service.
Verify that an encryption type response for an known system that has changed its encryption type generates an encrypt type updated event and the entry is saved to the remote system encryption service .
@Test
    public void testEncryptionResponseMsgKnownSystemAndChangedType()
    {
        int controllerId = 123;
        when(m_RemoteSystemEncryption.getEncryptType(controllerId)).thenReturn(EncryptType.AES_ECDH_ECDSA);
        Event event = mockEncryptionTypeResponse(controllerId, EncryptType.NONE);
        m_EncryptionInfoEventHelper.handleEvent(event);
        ArgumentCaptor<Event> captor = ArgumentCaptor.forClass(Event.class);
        verify(m_EventAdmin).postEvent(captor.capture());
        String topic = captor.getAllValues().get(0).getTopic();
        String type = (String)captor.getAllValues().get(0).getProperty(ControllerEncryptionConstants.
                EVENT_PROP_ENCRYPTION_TYPE);
        int systemId = (Integer)captor.getAllValues().get(0).getProperty(SharedPropertyConstants.
                EVENT_PROP_CONTROLLER_ID);
        assertThat(topic, is(ControllerEncryptionConstants.TOPIC_CONTROLLER_ENCRYPTION_TYPE_UPDATED));
        assertThat(EncryptType.valueOf(type), is(EncryptType.NONE));
        assertThat(systemId, is(controllerId));
        verify(m_RemoteSystemEncryption).addEncryptionTypeForSystem(controllerId, EncryptType.NONE);
    }
@ Test public void testEncryptionResponseMsgKnownSystemAndChangedType ( ) { int controllerId = 123 ; when ( m_RemoteSystemEncryption . getEncryptType ( controllerId ) ) . thenReturn ( EncryptType . AES_ECDH_ECDSA ) ; Event event = mockEncryptionTypeResponse ( controllerId , EncryptType . NONE ) ; m_EncryptionInfoEventHelper . handleEvent ( event ) ; ArgumentCaptor < Event > captor = ArgumentCaptor . forClass ( Event . class ) ; verify ( m_EventAdmin ) . postEvent ( captor . capture ( ) ) ; String topic = captor . getAllValues ( ) . get ( 0 ) . getTopic ( ) ; String type = ( String ) captor . getAllValues ( ) . get ( 0 ) . getProperty ( ControllerEncryptionConstants . EVENT_PROP_ENCRYPTION_TYPE ) ; int systemId = ( Integer ) captor . getAllValues ( ) . get ( 0 ) . getProperty ( SharedPropertyConstants . EVENT_PROP_CONTROLLER_ID ) ; assertThat ( topic , is ( ControllerEncryptionConstants . TOPIC_CONTROLLER_ENCRYPTION_TYPE_UPDATED ) ) ; assertThat ( EncryptType . valueOf ( type ) , is ( EncryptType . NONE ) ) ; assertThat ( systemId , is ( controllerId ) ) ; verify ( m_RemoteSystemEncryption ) . addEncryptionTypeForSystem ( controllerId , EncryptType . NONE ) ; }
Verify that an encryption type response for an known system that has changed its encryption type
 generates an encrypt type updated event and the entry is saved to the remote system encryption service.
Verify that an encryption type response for an known system that has changed its encryption type generates an encrypt type updated event and the entry is saved to the remote system encryption service .
//mock encryption response for new controller //assert that first encryption type updated event is posted