VWOError extends Entry { public JSONObject getErrorAsJSON() throws JSONException { JSONObject jsonObject = new JSONObject(); jsonObject.put(ID, builder.id); jsonObject.put(STACKTRACE, builder.stackTrace); jsonObject.put(VERSION, builder.versionName); jsonObject.put(VERSION_CODE, builder.versionCode); jsonObject.put(MESSAGE, builder.message); jsonObject.put(TIMESTAMP, builder.timestamp); jsonObject.put(ANDROID_VERSION, builder.androidVersion); jsonObject.put(DEVICE_UUID, builder.deviceUUID); if (builder.extras != null && builder.extras.size() != 0) { jsonObject.put(EXTRAS, new JSONObject(builder.extras)); } if (builder.deviceInfoExtras != null && builder.deviceInfoExtras.size() != 0) { jsonObject.put(DEVICE_INFO_EXTRAS, new JSONObject(builder.deviceInfoExtras)); } return jsonObject; } private  VWOError(String url, Builder builder); JSONObject getErrorAsJSON(); @Override String getKey(); static final String MANUFACTURER; static final String BRAND; static final String MODEL; static final String PACKAGE_NAME; static final String VWO_SDK_VERSION; static final String VWO_SDK_VERSION_CODE; static final String EXTERNAL_STORAGE_SIZE; static final String INTERNAL_STORAGE_SIZE; static final String AVAILABLE_EXTERNAL_STORAGE; static final String AVAILABLE_INTERNAL_STORAGE; static final String AVAILABLE_MEMORY; static final String TOTAL_MEMORY; static final String IS_MEMORY_LOW; }
@Test public void test() throws JSONException, IOException, ClassNotFoundException { VWOError.Builder builder = new VWOError.Builder("http: builder.exception(new Exception("This is a test exception")); VWOError inData = builder.build(); byte[] parceledData = Serializer.marshall(inData); VWOError outData = Serializer.unmarshall(parceledData, VWOError.class); Assert.assertEquals(outData.getErrorAsJSON().toString(), inData.getErrorAsJSON().toString()); }