/*
 * Copyright (c) 2017, Apptentive, Inc. All Rights Reserved.
 * Please refer to the LICENSE file for the terms and conditions
 * under which redistribution and use of this file is permitted.
 */

package com.apptentive.android.sdk.storage;

import com.apptentive.android.sdk.TestCaseBase;
import com.apptentive.android.sdk.encryption.Encryptor;
import com.apptentive.android.sdk.model.EventPayload;

import org.json.JSONObject;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

public class EncryptedPayloadSenderTest extends TestCaseBase {

	private static final String AUTH_TOKEN = "auth_token";
	private static final String ENCRYPTION_KEY = "5C5361D08DA7AD6CD70ACEB572D387BB713A312DE8CE6128B8A42F62A7B381DB";
	private static final String EVENT_LABEL = "com.apptentive#app#launch";

	@Test
	public void testEncryptedPayload() throws Exception {

/*
		final EventPayload original = new EventPayload(EVENT_LABEL, "trigger");
		original.setToken(AUTH_TOKEN);
		original.setEncryptionKey(ENCRYPTION_KEY);

		byte[] cipherText = original.getData(file);

		Encryptor encryptor = new Encryptor(ENCRYPTION_KEY);

		try {
			byte[] plainText = encryptor.decrypt(cipherText);
			JSONObject resultJson = new JSONObject(new String(plainText));
			EventPayload result = new EventPayload(resultJson.getJSONObject("payload").toString());
			assertEquals(result.getEventLabel(), EVENT_LABEL);
		} catch (Exception e) {
			fail(e.getMessage());
		}
*/
		throw new Exception("FIXME");
	}
}
@@ -400,36 +400,8 @@
 d;%0A%0A
-import org.json.JSONObject;%0A
 impo
@@ -419,16 +419,16 @@
 t.Test;%0A
+
 %0Aimport 
@@ -873,19 +873,16 @@
 tion %7B%0A%0A
-/*%0A
 %09%09final 
@@ -1061,20 +1061,19 @@
 nal.
-get
+render
 Data(
-file
 );%0A%0A
@@ -1196,158 +1196,67 @@
 %0A%09%09%09
-JSONObject resultJson = new JSONObject(new String(plainText));%0A%09%09%09EventPayload result = new EventPayload(resultJson.getJSONObject(%22payload%22).toString(
+EventPayload result = new EventPayload(new String(plainText
 ));%0A
@@ -1364,47 +1364,12 @@
 ));%0A
+
 %09%09%7D%0A
-*/%0A%09%09throw new Exception(%22FIXME%22);%0A
 %09%7D%0A%7D

Fix encryptor test.