### Question:
BlobModule extends ReactContextBaseJavaModule { @ReactMethod public void createFromParts(ReadableArray parts, String blobId) { int totalBlobSize = 0; ArrayList<byte[]> partList = new ArrayList<>(parts.size()); for (int i = 0; i < parts.size(); i++) { ReadableMap part = parts.getMap(i); switch (part.getString("type")) { case "blob": ReadableMap blob = part.getMap("data"); totalBlobSize += blob.getInt("size"); partList.add(i, resolve(blob)); break; case "string": byte[] bytes = part.getString("data").getBytes(Charset.forName("UTF-8")); totalBlobSize += bytes.length; partList.add(i, bytes); break; default: throw new IllegalArgumentException("Invalid type for blob: " + part.getString("type")); } } ByteBuffer buffer = ByteBuffer.allocate(totalBlobSize); for (byte[] bytes : partList) { buffer.put(bytes); } store(buffer.array(), blobId); } BlobModule(ReactApplicationContext reactContext); @Override String getName(); @Override @Nullable Map<String, Object> getConstants(); String store(byte[] data); void store(byte[] data, String blobId); void remove(String blobId); @Nullable byte[] resolve(Uri uri); @Nullable byte[] resolve(String blobId, int offset, int size); @Nullable byte[] resolve(ReadableMap blob); @ReactMethod void addNetworkingHandler(); @ReactMethod void addWebSocketHandler(final int id); @ReactMethod void removeWebSocketHandler(final int id); @ReactMethod void sendOverSocket(ReadableMap blob, int id); @ReactMethod void createFromParts(ReadableArray parts, String blobId); @ReactMethod void release(String blobId);  }### Answer:
@Test public void testCreateFromParts() { String id = UUID.randomUUID().toString(); JavaOnlyMap blobData = new JavaOnlyMap(); blobData.putString("blobId", mBlobId); blobData.putInt("offset", 0); blobData.putInt("size", mBytes.length); JavaOnlyMap blob = new JavaOnlyMap(); blob.putMap("data", blobData); blob.putString("type", "blob"); String stringData = "i \u2665 dogs"; byte[] stringBytes = stringData.getBytes(Charset.forName("UTF-8")); JavaOnlyMap string = new JavaOnlyMap(); string.putString("data", stringData); string.putString("type", "string"); JavaOnlyArray parts = new JavaOnlyArray(); parts.pushMap(blob); parts.pushMap(string); mBlobModule.createFromParts(parts, id); int resultSize = mBytes.length + stringBytes.length; byte[] result = mBlobModule.resolve(id, 0, resultSize); ByteBuffer buffer = ByteBuffer.allocate(resultSize); buffer.put(mBytes); buffer.put(stringBytes); assertArrayEquals(result, buffer.array()); }