private void saveMetadata() { checkConversationQueue(); try { if (ApptentiveLog.canLog(VERBOSE)) { ApptentiveLog.v(CONVERSATION, "Saving metadata: ", conversationMetadata.toString()); } long start = System.currentTimeMillis(); File metaFile = new File(conversationsStorageDir, CONVERSATION_METADATA_FILE); ObjectSerialization.serialize(metaFile, conversationMetadata, encryptionKey); ApptentiveLog.v(CONVERSATION, "Saved metadata (took %d ms)", System.currentTimeMillis() - start); } catch (Exception e) { ApptentiveLog.e(CONVERSATION, e, "Exception while saving metadata"); logException(e); } }
@Test public void testSerialization() throws IOException { Dummy expected = new Dummy("Some value"); ObjectSerialization.serialize(file, expected); Dummy actual = ObjectSerialization.deserialize(file, Dummy.class); assertEquals(expected, actual); }