@Override public void read(JSONObject object) throws JSONException { super.read(object); setPushToken(object.getString(PUSH_TOKEN)); }
@Override public void read(JSONObject object) throws JSONException { super.read(object); setProperties(JSONUtils.readMap(object, PROPERTIES)); }
@Override public void read(JSONObject object) throws JSONException { super.read(object); setServices(JSONUtils.readStringArray(object, SERVICES)); }
@Override public void read(JSONObject object) throws JSONException { super.read(object); setProperties(readProperties(object)); }
@Override public void read(JSONObject object) throws JSONException { super.read(object); setId(UUID.fromString(object.getString(ID))); setErrorId(UUID.fromString(object.getString(ERROR_ID))); setContentType(object.getString(CONTENT_TYPE)); setFileName(object.optString(FILE_NAME, null)); try { setData(Base64.decode(object.getString(DATA), Base64.DEFAULT)); } catch (IllegalArgumentException e) { throw new JSONException(e.getMessage()); } }
@Test(expected = JSONException.class) public void readDifferentTypeTest() throws JSONException { JSONObject mockJsonObject = mock(JSONObject.class); when(mockJsonObject.getString(CommonProperties.TYPE)).thenReturn("type"); AbstractLog mockLog = new MockLog(); mockLog.read(mockJsonObject); }
@Override public void read(JSONObject object) throws JSONException { super.read(object); setId(UUID.fromString(object.getString(ID))); setProcessId(JSONUtils.readInteger(object, PROCESS_ID)); setProcessName(object.optString(PROCESS_NAME, null)); setParentProcessId(JSONUtils.readInteger(object, PARENT_PROCESS_ID)); setParentProcessName(object.optString(PARENT_PROCESS_NAME, null)); setErrorThreadId(JSONUtils.readLong(object, ERROR_THREAD_ID)); setErrorThreadName(object.optString(ERROR_THREAD_NAME, null)); setFatal(JSONUtils.readBoolean(object, FATAL)); setAppLaunchTimestamp(JSONDateUtils.toDate(object.getString(APP_LAUNCH_TIMESTAMP))); setArchitecture(object.optString(ARCHITECTURE, null)); }