@@ -0,0 +1,1491 @@
+/*%0A * Copyright (c) 2017, Apptentive, Inc. All Rights Reserved.%0A * Please refer to the LICENSE file for the terms and conditions%0A * under which redistribution and use of this file is permitted.%0A */%0A%0Apackage com.apptentive.android.sdk.storage;%0A%0Aimport com.apptentive.android.sdk.TestCaseBase;%0Aimport com.apptentive.android.sdk.encryption.Encryptor;%0Aimport com.apptentive.android.sdk.model.EventPayload;%0A%0Aimport org.json.JSONObject;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.fail;%0A%0Apublic class EncryptedPayloadSenderTest extends TestCaseBase %7B%0A%0A%09private static final String AUTH_TOKEN = %22auth_token%22;%0A%09private static final String ENCRYPTION_KEY = %225C5361D08DA7AD6CD70ACEB572D387BB713A312DE8CE6128B8A42F62A7B381DB%22;%0A%09private static final String EVENT_LABEL = %22com.apptentive#app#launch%22;%0A%0A%09@Test%0A%09public void testEncryptedPayload() throws Exception %7B%0A%0A%09%09final EventPayload original = new EventPayload(EVENT_LABEL, %22trigger%22);%0A%09%09original.setToken(AUTH_TOKEN);%0A%09%09original.setEncryptionKey(ENCRYPTION_KEY);%0A%0A%09%09byte%5B%5D cipherText = original.getData();%0A%0A%09%09Encryptor encryptor = new Encryptor(ENCRYPTION_KEY);%0A%0A%09%09try %7B%0A%09%09%09byte%5B%5D plainText = encryptor.decrypt(cipherText);%0A%09%09%09JSONObject resultJson = new JSONObject(new String(plainText));%0A%09%09%09EventPayload result = new EventPayload(resultJson.getJSONObject(%22payload%22).toString());%0A%09%09%09assertEquals(result.getEventLabel(), EVENT_LABEL);%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09fail(e.getMessage());%0A%09%09%7D%0A%09%7D%0A%7D

Add test for encrypted payloads.