@ -54,7 +54,7 @@ class JNI1118Context extends CTXBase {
msgToBobEncrypted = engine . encrypt_message ( msgAliceToBob , null , Message . EncFormat . PEP ) ;
msgToBobDecrypted = msgToBobEncrypted ;
msgToBobDecryptResult = engine . decrypt_message ( msgToBobDecrypted , new Vector < String > ( ) , 0 ) ;
msgToBobDecryptResult = engine . decrypt_message ( msgToBobDecrypted , DecryptFlags . pEpDecryptFlagOwnPrivateKey ) ;
if ( msgToBobEncrypted = = null ) {
throw new RuntimeException ( "Context failure, error decrypting message" ) ;
}
@ -67,26 +67,6 @@ class TestAlice {
TestSuite . getDefault ( ) . setVerbose ( true ) ;
TestSuite . getDefault ( ) . setTestColor ( TestUtils . TermColor . GREEN ) ;
new TestUnit < JNI1118Context > ( "re_evaluate_message_rating() equal to decrypt_message_result.rating when Message has correct OptFields" , new JNI1118Context ( ) , ctx - > {
AdapterTestUtils . addRatingToOptFields ( ctx . msgToBobDecrypted , ctx . msgToBobDecryptResult . rating . getInternalStringValue ( ) ) ;
AdapterTestUtils . addRcptsToOptFields ( ctx . msgToBobDecrypted , Identity . toXKeyList ( ctx . msgToBobDecrypted . getTo ( ) ) ) ;
log ( "running re_evaluate_message_rating() on:\n" + AdapterTestUtils . msgToString ( ctx . msgToBobDecrypted , false ) ) ;
Rating rat = ctx . engine . re_evaluate_message_rating ( ctx . msgToBobDecrypted ) ;
log ( "re_evaluate_message_rating() result: " + rat . toString ( ) ) ;
assert rat = = ctx . msgToBobDecryptResult . rating : "Rating is " + rat . toString ( ) + ",but should be " + ctx . msgToBobDecryptResult . rating . toString ( ) ;
} ) ;
new TestUnit < JNI1118Context > ( "re_evaluate_message_rating() equal to decrypt_message_result.rating when Message has random rating string on XEncStatus" , new JNI1118Context ( ) , ctx - > {
AdapterTestUtils . addRatingToOptFields ( ctx . msgToBobDecrypted , TestUtils . randomASCIIString ( TestUtils . EASCIICharClassName . All , TestUtils . randomInt ( new RangeInt ( 0 , 42 ) ) ) ) ;
AdapterTestUtils . addRcptsToOptFields ( ctx . msgToBobDecrypted , Identity . toXKeyList ( ctx . msgToBobDecrypted . getTo ( ) ) ) ;
log ( "running re_evaluate_message_rating() on:\n" + AdapterTestUtils . msgToString ( ctx . msgToBobDecrypted , false ) ) ;
Rating rat = ctx . engine . re_evaluate_message_rating ( ctx . msgToBobDecrypted ) ;
log ( "re_evaluate_message_rating() result: " + rat . toString ( ) ) ;
assert rat = = ctx . msgToBobDecryptResult . rating : "Rating is " + rat . toString ( ) + ",but should be " + ctx . msgToBobDecryptResult . rating . toString ( ) ;
} ) ;
TestSuite . getDefault ( ) . run ( ) ;
}
}