Browse Source

JNI-167: Test - add fromXER()

JNI-167
heck 3 years ago
parent
commit
2e74dc2135
  1. 38
      test/java/foundation/pEp/jniadapter/test/jni167/TestAlice.java

38
test/java/foundation/pEp/jniadapter/test/jni167/TestAlice.java

@ -1,5 +1,7 @@
package foundation.pEp.jniadapter.test.jni167; package foundation.pEp.jniadapter.test.jni167;
import foundation.pEp.jniadapter.Message;
import foundation.pEp.jniadapter.test.utils.AdapterTestUtils;
import foundation.pEp.jniadapter.test.utils.CTXBase; import foundation.pEp.jniadapter.test.utils.CTXBase;
import foundation.pEp.pitytest.TestSuite; import foundation.pEp.pitytest.TestSuite;
import foundation.pEp.pitytest.TestUnit; import foundation.pEp.pitytest.TestUnit;
@ -11,6 +13,9 @@ import static foundation.pEp.pitytest.TestLogger.log;
/* /*
JNI-167 - ASN1 Support JNI-167 - ASN1 Support
TODO:
just spot test that the encoding/decoding generally works. Dont test the whole codec.
*/ */
@ -21,12 +26,41 @@ class TestAlice {
CTXBase ctxBase = new CTXBase(); CTXBase ctxBase = new CTXBase();
new TestUnit<CTXBase>("encodeASN1XER", ctxBase, ctx -> { new TestUnit<CTXBase>("toXER", ctxBase, ctx -> {
log("fdfd"); log("fdfd");
String tmp = ctx.msgAliceToAlice.encodeASN1XER(); String tmp = ctx.msgAliceToAlice.toXER();
log(tmp); log(tmp);
}); });
new TestUnit<CTXBase>("decodeASN1XER", ctxBase, ctx -> {
log("fdfd");
String msgXER = "<ASN1Message>\n" +
" <from>\n" +
" <address>alice@peptest.org</address>\n" +
" <user-id></user-id>\n" +
" <username>alice</username>\n" +
" <comm-type>0</comm-type>\n" +
" <lang>en</lang>\n" +
" </from>\n" +
" <to>\n" +
" <PIdentity>\n" +
" <address>bob@peptest.org</address>\n" +
" <user-id></user-id>\n" +
" <username>bob</username>\n" +
" <comm-type>0</comm-type>\n" +
" <lang>en</lang>\n" +
" </PIdentity>\n" +
" </to>\n" +
" <shortmsg>Hi i am the shortMessage</shortmsg>\n" +
" <longmsg>Hi i am the longMessage</longmsg>\n" +
"</ASN1Message>\n";
Message m = Message.fromXER(msgXER);
log(AdapterTestUtils.msgToString(m, false));
});
TestSuite.getDefault().run(); TestSuite.getDefault().run();
} }
} }

Loading…
Cancel
Save