mil.dod.th.ose.remote/test/mil/dod/th/ose/remote/messaging/TestMessageSenderImpl.java
@Test
    public void testUnknownEncryptionType() throws IOException
    {
        //set the service
        m_SUT.setRemoteSystemEncryption(m_RemoteSystemEncryption);
        when(m_RemoteSettings.getEncryptionMode()).thenReturn(EncryptionMode.AES_ECDH_ECDSA);

        // construct data message to send
        ControllerInfoData controllerInfoData = ControllerInfoData.newBuilder().setName("blah").build();
        
        TerraHarvestMessage request = 
                createMessageWithDestSource(m_LocalId, m_RemoteId, 0 , Namespace.Base, controllerInfoData);
        
        TerraHarvestPayload payload = TerraHarvestPayload.parseFrom(request.getTerraHarvestPayload());
        
        when(m_EncryptService.encryptMessage(Mockito.any(Builder.class), Mockito.any(TerraHarvestPayload.class))).
            thenReturn(request);
        
        try
        {
            m_SUT.queueMessage(m_RemoteId, payload, null);
            fail("Expecting exception as remote id is not known by remote encryption service");
        }
        catch (IllegalArgumentException e)
        {
            
        }
    }
/**
     * Verify if the encryption type is not known for a system, an exception is thrown
     */
Verify if the encryption type is not known for a system, an exception is thrown
Verify if the encryption type is not known for a system an exception is thrown
@Test
    public void testUnknownEncryptionType() throws IOException
    {
        m_SUT.setRemoteSystemEncryption(m_RemoteSystemEncryption);
        when(m_RemoteSettings.getEncryptionMode()).thenReturn(EncryptionMode.AES_ECDH_ECDSA);
        ControllerInfoData controllerInfoData = ControllerInfoData.newBuilder().setName("blah").build();
        TerraHarvestMessage request = 
                createMessageWithDestSource(m_LocalId, m_RemoteId, 0 , Namespace.Base, controllerInfoData);
        TerraHarvestPayload payload = TerraHarvestPayload.parseFrom(request.getTerraHarvestPayload());
        when(m_EncryptService.encryptMessage(Mockito.any(Builder.class), Mockito.any(TerraHarvestPayload.class))).
            thenReturn(request);
        try
        {
            m_SUT.queueMessage(m_RemoteId, payload, null);
            fail("Expecting exception as remote id is not known by remote encryption service");
        }
        catch (IllegalArgumentException e)
        {
        }
    }
@ Test public void testUnknownEncryptionType ( ) throws IOException { m_SUT . setRemoteSystemEncryption ( m_RemoteSystemEncryption ) ; when ( m_RemoteSettings . getEncryptionMode ( ) ) . thenReturn ( EncryptionMode . AES_ECDH_ECDSA ) ; ControllerInfoData controllerInfoData = ControllerInfoData . newBuilder ( ) . setName ( "blah" ) . build ( ) ; TerraHarvestMessage request = createMessageWithDestSource ( m_LocalId , m_RemoteId , 0 , Namespace . Base , controllerInfoData ) ; TerraHarvestPayload payload = TerraHarvestPayload . parseFrom ( request . getTerraHarvestPayload ( ) ) ; when ( m_EncryptService . encryptMessage ( Mockito . any ( Builder . class ) , Mockito . any ( TerraHarvestPayload . class ) ) ) . thenReturn ( request ) ; try { m_SUT . queueMessage ( m_RemoteId , payload , null ) ; fail ( "Expecting exception as remote id is not known by remote encryption service" ) ; } catch ( IllegalArgumentException e ) { } }
Verify if the encryption type is not known for a system, an exception is thrown
Verify if the encryption type is not known for a system an exception is thrown
//set the service // construct data message to send