@@ -0,0 +1,3321 @@
+package com.fsck.k9.controller;%0A%0A%0Aimport java.util.HashMap;%0A%0Aimport com.fsck.k9.controller.MessagingControllerCommands.PendingAppend;%0Aimport com.fsck.k9.controller.MessagingControllerCommands.PendingCommand;%0Aimport com.fsck.k9.controller.MessagingControllerCommands.PendingEmptyTrash;%0Aimport com.fsck.k9.controller.MessagingControllerCommands.PendingMoveOrCopy;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A%0A%0Apublic class PendingCommandSerializerTest %7B%0A    static final int DATABASE_ID = 123;%0A    static final String UID = %22uid%22;%0A    static final String SOURCE_FOLDER = %22source_folder%22;%0A    static final String DEST_FOLDER = %22dest_folder%22;%0A    static final HashMap%3CString, String%3E UID_MAP = new HashMap%3C%3E();%0A    public static final boolean IS_COPY = true;%0A%0A    static %7B%0A        UID_MAP.put(%22uid_1%22, %22uid_other_1%22);%0A        UID_MAP.put(%22uid_2%22, %22uid_other_2%22);%0A    %7D%0A%0A%0A    PendingCommandSerializer pendingCommandSerializer = PendingCommandSerializer.getInstance();%0A%0A%0A    @Test%0A    public void testSerializeDeserialize__withoutArguments() %7B%0A        PendingCommand pendingCommand = MessagingControllerCommands.createEmptyTrash();%0A%0A        String serializedCommand = pendingCommandSerializer.serialize(pendingCommand);%0A        PendingEmptyTrash unserializedCommand = (PendingEmptyTrash) pendingCommandSerializer.unserialize(%0A                DATABASE_ID, pendingCommand.getCommandName(), serializedCommand);%0A%0A        assertEquals(DATABASE_ID, unserializedCommand.databaseId);%0A    %7D%0A%0A    @Test%0A    public void testSerializeDeserialize__withArguments() %7B%0A        PendingCommand pendingCommand = MessagingControllerCommands.createAppend(SOURCE_FOLDER, UID);%0A%0A        String serializedCommand = pendingCommandSerializer.serialize(pendingCommand);%0A        PendingAppend unserializedCommand = (PendingAppend) pendingCommandSerializer.unserialize(%0A                DATABASE_ID, pendingCommand.getCommandName(), serializedCommand);%0A%0A        assertEquals(DATABASE_ID, unserializedCommand.databaseId);%0A        assertEquals(SOURCE_FOLDER, unserializedCommand.folder);%0A        assertEquals(UID, unserializedCommand.uid);%0A    %7D%0A%0A    @Test%0A    public void testSerializeDeserialize__withComplexArguments() %7B%0A        PendingCommand pendingCommand = MessagingControllerCommands.createMoveOrCopyBulk(%0A                SOURCE_FOLDER, DEST_FOLDER, IS_COPY, UID_MAP);%0A%0A        String serializedCommand = pendingCommandSerializer.serialize(pendingCommand);%0A        PendingMoveOrCopy unserializedCommand = (PendingMoveOrCopy) pendingCommandSerializer.unserialize(%0A                DATABASE_ID, pendingCommand.getCommandName(), serializedCommand);%0A%0A        assertEquals(DATABASE_ID, unserializedCommand.databaseId);%0A        assertEquals(SOURCE_FOLDER, unserializedCommand.srcFolder);%0A        assertEquals(DEST_FOLDER, unserializedCommand.destFolder);%0A        assertEquals(UID_MAP, unserializedCommand.newUidMap);%0A    %7D%0A%0A    @Test(expected = IllegalArgumentException.class)%0A    public void testDeserialize__withUnknownCommandName__shouldFail() %7B%0A        PendingCommand pendingCommand = MessagingControllerCommands.createEmptyTrash();%0A%0A        String serializedCommand = pendingCommandSerializer.serialize(pendingCommand);%0A        pendingCommandSerializer.unserialize(DATABASE_ID,  %22BAD_COMMAND_NAME%22, serializedCommand);%0A    %7D%0A%0A%7D

add unit tests for PendingCommand serialization