diff --git a/test/java/foundation/pEp/jniadapter/test/jni118/TestAlice.java b/test/java/foundation/pEp/jniadapter/test/jni118/TestAlice.java index 7f3380d..72ff9ce 100644 --- a/test/java/foundation/pEp/jniadapter/test/jni118/TestAlice.java +++ b/test/java/foundation/pEp/jniadapter/test/jni118/TestAlice.java @@ -60,19 +60,6 @@ class JNI1118Context extends AdapterBaseTestContext { } return this; } - - public void addRatingToOptFields(Message msg, String ratingStr) { - ArrayList> opts = msg.getOptFields(); - opts.add(new Pair("X-EncStatus",ratingStr)); - msg.setOptFields(opts); - } - - public void addRcptsToOptFields(Message msg, String fprs) { - ArrayList> opts = msg.getOptFields(); - opts.add(new Pair("X-KeyList", fprs)); - msg.setOptFields(opts); - } - } class TestAlice { @@ -81,8 +68,8 @@ class TestAlice { TestSuite.getDefault().setTestColor(TestUtils.TermColor.GREEN); new TestUnit("re_evaluate_message_rating() equal to decrypt_message_result.rating when Message has correct OptFields", new JNI1118Context(), ctx -> { - ctx.addRatingToOptFields(ctx.msgToBobDecrypted,ctx.msgToBobDecryptResult.rating.getInternalStringValue()); - ctx.addRcptsToOptFields(ctx.msgToBobDecrypted,Identity.toXKeyList(ctx.msgToBobDecrypted.getTo())); + 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()); @@ -90,8 +77,8 @@ class TestAlice { }); new TestUnit("re_evaluate_message_rating() equal to decrypt_message_result.rating when Message has random rating string on XEncStatus", new JNI1118Context(), ctx -> { - ctx.addRatingToOptFields(ctx.msgToBobDecrypted, TestUtils.randomASCIIString(TestUtils.CharClass.Unbounded, TestUtils.randomInt(0,42))); - ctx.addRcptsToOptFields(ctx.msgToBobDecrypted,Identity.toXKeyList(ctx.msgToBobDecrypted.getTo())); + AdapterTestUtils.addRatingToOptFields(ctx.msgToBobDecrypted, TestUtils.randomASCIIString(TestUtils.CharClass.Unbounded, TestUtils.randomInt(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()); diff --git a/test/java/foundation/pEp/jniadapter/test/utils/AdapterTestUtils.java b/test/java/foundation/pEp/jniadapter/test/utils/AdapterTestUtils.java index e377c8b..2f3921b 100644 --- a/test/java/foundation/pEp/jniadapter/test/utils/AdapterTestUtils.java +++ b/test/java/foundation/pEp/jniadapter/test/utils/AdapterTestUtils.java @@ -344,7 +344,6 @@ public class AdapterTestUtils { } - public static DiffResult diff(byte[] left, byte[] right) { DiffResult ret = new DiffResult(); String diffString = ""; @@ -369,5 +368,18 @@ public class AdapterTestUtils { ret.setFirstDiffByte(firstDiff); return ret; } + + public static void addRatingToOptFields(Message msg, String ratingStr) { + ArrayList> opts = msg.getOptFields(); + opts.add(new Pair("X-EncStatus",ratingStr)); + msg.setOptFields(opts); + } + + public static void addRcptsToOptFields(Message msg, String fprs) { + ArrayList> opts = msg.getOptFields(); + opts.add(new Pair("X-KeyList", fprs)); + msg.setOptFields(opts); + } + }