Browse Source

AdapterTestUtils - Blob and BlobList factory methods

JNI-134
heck 4 years ago
parent
commit
2ca43ba85c
  1. 24
      test/java/foundation/pEp/jniadapter/test/utils/AdapterTestUtils.java

24
test/java/foundation/pEp/jniadapter/test/utils/AdapterTestUtils.java

@ -1,6 +1,9 @@
package foundation.pEp.jniadapter.test.utils;
import foundation.pEp.jniadapter.*;
import foundation.pEp.jniadapter.Blob;
import foundation.pEp.jniadapter.Identity;
import foundation.pEp.jniadapter.Message;
import foundation.pEp.jniadapter.Pair;
import java.util.ArrayList;
import java.util.Vector;
@ -272,6 +275,25 @@ public class AdapterTestUtils {
return spv;
}
// Factory methods to create test objects
public static Vector<Blob> makeNewTestBlobList(int len) {
Vector<Blob> blbList = new Vector<>();
for (int i = 0; i < len; i++) {
Blob blb = makeNewTestBlob("Attachement nr: " + i + " [TEST DATA]", "testfilename"+i+".txt", "text/plain" );
blbList.add(blb);
}
return blbList;
}
public static Blob makeNewTestBlob(String data, String filename, String mime_type) {
Blob blb = new Blob();
blb.data = data.getBytes();
blb.filename = filename;
blb.mime_type = mime_type;
return blb;
}
public static Message makeNewTestMessage(Identity from, Identity to, Message.Direction dir) {
Message msg = new Message();
Vector<Identity> vID = new Vector<Identity>();

Loading…
Cancel
Save