IOS-1521 write it down please, I'll take care later IOS-1521+IOS-1495
authorbuff <andreas@pep-project.org>
Fri, 17 May 2019 11:17:09 +0200
branchIOS-1521+IOS-1495
changeset 86629f7c8a994889
parent 8661 fcc5cfa975aa
child 8663 c91c1cbd1566
IOS-1521 write it down please, I'll take care later
pEpForiOSTests/Util/ComposeUtilTest.swift
     1.1 --- a/pEpForiOSTests/Util/ComposeUtilTest.swift	Fri May 17 11:04:30 2019 +0200
     1.2 +++ b/pEpForiOSTests/Util/ComposeUtilTest.swift	Fri May 17 11:17:09 2019 +0200
     1.3 @@ -1,497 +1,499 @@
     1.4 +//!!!: broke by merging IOS-1542.
     1.5 +
     1.6 +////
     1.7 +////  ComposeUtilTest.swift
     1.8 +////  pEpForiOSTests
     1.9 +////
    1.10 +////  Created by Andreas Buff on 19.07.18.
    1.11 +////  Copyright © 2018 p≡p Security S.A. All rights reserved.
    1.12 +////
    1.13  //
    1.14 -//  ComposeUtilTest.swift
    1.15 -//  pEpForiOSTests
    1.16 +//import XCTest
    1.17 +//import MessageModel
    1.18  //
    1.19 -//  Created by Andreas Buff on 19.07.18.
    1.20 -//  Copyright © 2018 p≡p Security S.A. All rights reserved.
    1.21 +//@testable import pEpForiOS
    1.22  //
    1.23 -
    1.24 -import XCTest
    1.25 -import MessageModel
    1.26 -
    1.27 -@testable import pEpForiOS
    1.28 -
    1.29 -class ComposeUtilTest: CoreDataDrivenTestBase {
    1.30 -    var someone_A: Identity {
    1.31 -        return createForeignIdentity(withId: "A")
    1.32 -    }
    1.33 -
    1.34 -    var someone_B: Identity {
    1.35 -        return createForeignIdentity(withId: "B")
    1.36 -    }
    1.37 -
    1.38 -    var someone_C: Identity {
    1.39 -        return createForeignIdentity(withId: "C")
    1.40 -    }
    1.41 -
    1.42 -    var meCurrentlyUsedAccount: Identity {
    1.43 -        return account.user
    1.44 -    }
    1.45 -
    1.46 -    let noRecipients = [Identity]()
    1.47 -
    1.48 -    var meSomeUnusedAccount: Identity!
    1.49 -
    1.50 -    override func setUp() {
    1.51 -        super.setUp()
    1.52 -        cdAccount.createRequiredFoldersAndWait(testCase: self)
    1.53 -        meSomeUnusedAccount = SecretTestData().createWorkingAccount(number: 1).user
    1.54 -    }
    1.55 -
    1.56 -    // MARK: - REPLY
    1.57 -
    1.58 -    // MARK: FolderType !~ [.sent, .draft]
    1.59 -
    1.60 -    /*
    1.61 -     1) From: Someone A To: Me X CC: ANY
    1.62 -     - Reply Any Mailbox != sent:
    1.63 -     algo: from -> to, to -> from
    1.64 -     result: From: Me X To: Someone A CC: -- BCC: --
    1.65 -     */
    1.66 -    func testReply_inbox_fromSomeoneA_toMe_ccNone_bccNone() {
    1.67 -        let mode = ComposeUtil.ComposeMode.replyFrom
    1.68 -        // Original message
    1.69 -        let folderType = FolderType.inbox
    1.70 -        let sender = someone_A
    1.71 -        let originalTos = [meCurrentlyUsedAccount]
    1.72 -        let originalCcs = noRecipients
    1.73 -        let originalBccs = noRecipients
    1.74 -        // Expected
    1.75 -        let expectedTos = [sender]
    1.76 -        let expectedCcs = noRecipients
    1.77 -        let expectedBccs = noRecipients
    1.78 -
    1.79 -        assertCorrectInitialRecipients(forReplyMode: mode,
    1.80 -                                       originalMessageParentFolderType: folderType,
    1.81 -                                       originalFrom: sender,
    1.82 -                                       originalTos: originalTos,
    1.83 -                                       originalCcs: originalCcs,
    1.84 -                                       originalBccs: originalBccs,
    1.85 -                                       expectedTos: expectedTos,
    1.86 -                                       expectedCcs: expectedCcs,
    1.87 -                                       expectedBccs: expectedBccs)
    1.88 -    }
    1.89 -
    1.90 -    func testReply_inbox_fromSomeoneA_toMe_ccSome_bccSome() {
    1.91 -        let mode = ComposeUtil.ComposeMode.replyFrom
    1.92 -        // Original message
    1.93 -        let folderType = FolderType.inbox
    1.94 -        let sender = someone_A
    1.95 -        let originalTos = [meCurrentlyUsedAccount]
    1.96 -        let originalCcs = [someone_B]
    1.97 -        let originalBccs = [someone_C]
    1.98 -        // Expected
    1.99 -        let expectedTos = [sender]
   1.100 -        let expectedCcs = noRecipients
   1.101 -        let expectedBccs = noRecipients
   1.102 -
   1.103 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.104 -                                       originalMessageParentFolderType: folderType,
   1.105 -                                       originalFrom: sender,
   1.106 -                                       originalTos: originalTos,
   1.107 -                                       originalCcs: originalCcs,
   1.108 -                                       originalBccs: originalBccs,
   1.109 -                                       expectedTos: expectedTos,
   1.110 -                                       expectedCcs: expectedCcs,
   1.111 -                                       expectedBccs: expectedBccs)
   1.112 -    }
   1.113 -
   1.114 -    // MARK: FolderType == .sent
   1.115 -
   1.116 -    /*
   1.117 -     1) From: Me X To: Someone A CC: ANY BCC:. ANY
   1.118 -     - Reply Any Mailbox == sent:
   1.119 -     algo: from -> from, to -> to
   1.120 -     result: From: Me X To: Someone A CC: -- BCC: --
   1.121 -     */
   1.122 -    func testReply_sent_fromSomeoneA_toMe_ccNone_bccNone() {
   1.123 -        let mode = ComposeUtil.ComposeMode.replyFrom
   1.124 -        // Original message
   1.125 -        let folderType = FolderType.sent
   1.126 -        let sender = meCurrentlyUsedAccount
   1.127 -        let originalTos = [someone_A]
   1.128 -        let originalCcs = noRecipients
   1.129 -        let originalBccs = noRecipients
   1.130 -        // Expected
   1.131 -        let expectedTos = originalTos
   1.132 -        let expectedCcs = noRecipients
   1.133 -        let expectedBccs = noRecipients
   1.134 -
   1.135 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.136 -                                       originalMessageParentFolderType: folderType,
   1.137 -                                       originalFrom: sender,
   1.138 -                                       originalTos: originalTos,
   1.139 -                                       originalCcs: originalCcs,
   1.140 -                                       originalBccs: originalBccs,
   1.141 -                                       expectedTos: expectedTos,
   1.142 -                                       expectedCcs: expectedCcs,
   1.143 -                                       expectedBccs: expectedBccs)
   1.144 -    }
   1.145 -
   1.146 -    func testReply_sent_fromSomeoneA_toMe_ccSome_bccSome() {
   1.147 -        let mode = ComposeUtil.ComposeMode.replyFrom
   1.148 -        // Original message
   1.149 -        let folderType = FolderType.sent
   1.150 -        let sender = meCurrentlyUsedAccount
   1.151 -        let originalTos = [someone_A]
   1.152 -        let originalCcs = [someone_B]
   1.153 -        let originalBccs = [someone_C]
   1.154 -        // Expected
   1.155 -        let expectedTos = originalTos
   1.156 -        let expectedCcs = noRecipients
   1.157 -        let expectedBccs = noRecipients
   1.158 -
   1.159 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.160 -                                       originalMessageParentFolderType: folderType,
   1.161 -                                       originalFrom: sender,
   1.162 -                                       originalTos: originalTos,
   1.163 -                                       originalCcs: originalCcs,
   1.164 -                                       originalBccs: originalBccs,
   1.165 -                                       expectedTos: expectedTos,
   1.166 -                                       expectedCcs: expectedCcs,
   1.167 -                                       expectedBccs: expectedBccs)
   1.168 -    }
   1.169 -
   1.170 -    // MARK: - REPLY ALL
   1.171 -
   1.172 -     // MARK: FolderType !~ [.sent, .draft]
   1.173 -
   1.174 -    /*
   1.175 -     From: Someone A To: Me X  CC: -- BCC: --
   1.176 -     - ReplyAll Mailbox !~ [.sent, .drafts]:
   1.177 -     algo: from -> me, to = from + (origTos - me)
   1.178 -     expected: From: Me X To: Someone A  CC: -- BCC: --
   1.179 -     */
   1.180 -    func testReplyAll_inbox_fromSomeoneA_toMe_ccNone_bccNone() {
   1.181 -        let mode = ComposeUtil.ComposeMode.replyAll
   1.182 -        // Original message
   1.183 -        let folderType = FolderType.inbox
   1.184 -        let sender = someone_A
   1.185 -        let originalTos = [meCurrentlyUsedAccount]
   1.186 -        let originalCcs = noRecipients
   1.187 -        let originalBccs = noRecipients
   1.188 -        // Expected
   1.189 -        let expectedTos = [sender]
   1.190 -        let expectedCcs = noRecipients
   1.191 -        let expectedBccs = noRecipients
   1.192 -
   1.193 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.194 -                                       originalMessageParentFolderType: folderType,
   1.195 -                                       originalFrom: sender,
   1.196 -                                       originalTos: originalTos,
   1.197 -                                       originalCcs: originalCcs,
   1.198 -                                       originalBccs: originalBccs,
   1.199 -                                       expectedTos: expectedTos,
   1.200 -                                       expectedCcs: expectedCcs,
   1.201 -                                       expectedBccs: expectedBccs)
   1.202 -    }
   1.203 -
   1.204 -    /*
   1.205 -     From: Someone A To: Me X, someone B CC: -- BCC: --
   1.206 -     - ReplyAll Mailbox !~ [.sent, .drafts]:
   1.207 -     algo: from -> me, to = from + (origTos - me)
   1.208 -     expected: From: Me X To: Someone A, someone B CC: --
   1.209 -     */
   1.210 -    func testReplyAll_inbox_fromSomeoneA_toSomeMeIncluded_ccNone_bccNone() {
   1.211 -        let mode = ComposeUtil.ComposeMode.replyAll
   1.212 -        // Original message
   1.213 -        let folderType = FolderType.inbox
   1.214 -        let sender = someone_A
   1.215 -        let originalTos = [meCurrentlyUsedAccount, someone_B]
   1.216 -        let originalCcs = noRecipients
   1.217 -        let originalBccs = noRecipients
   1.218 -        // Expected
   1.219 -        let expectedTos = [sender, someone_B]
   1.220 -        let expectedCcs = noRecipients
   1.221 -        let expectedBccs = noRecipients
   1.222 -
   1.223 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.224 -                                       originalMessageParentFolderType: folderType,
   1.225 -                                       originalFrom: sender,
   1.226 -                                       originalTos: originalTos,
   1.227 -                                       originalCcs: originalCcs,
   1.228 -                                       originalBccs: originalBccs,
   1.229 -                                       expectedTos: expectedTos,
   1.230 -                                       expectedCcs: expectedCcs,
   1.231 -                                       expectedBccs: expectedBccs)
   1.232 -    }
   1.233 -
   1.234 -    /*
   1.235 -     From: Someone A To: Me X  CC: someone B  BCC: --
   1.236 -     - ReplyAll Mailbox !~ [.sent, .drafts]:
   1.237 -     expected: From: Me X To: Someone A,  CC: someone B
   1.238 -     */
   1.239 -    func testReplyAll_inbox_fromSomeoneA_toMe_ccSomeMeNotIncluded_bccNone() {
   1.240 -        let mode = ComposeUtil.ComposeMode.replyAll
   1.241 -        // Original message
   1.242 -        let folderType = FolderType.inbox
   1.243 -        let sender = someone_A
   1.244 -        let originalTos = [meCurrentlyUsedAccount]
   1.245 -        let originalCcs = [someone_B]
   1.246 -        let originalBccs = noRecipients
   1.247 -        // Expected
   1.248 -        let expectedTos = [sender]
   1.249 -        let expectedCcs = originalCcs
   1.250 -        let expectedBccs = noRecipients
   1.251 -
   1.252 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.253 -                                       originalMessageParentFolderType: folderType,
   1.254 -                                       originalFrom: sender,
   1.255 -                                       originalTos: originalTos,
   1.256 -                                       originalCcs: originalCcs,
   1.257 -                                       originalBccs: originalBccs,
   1.258 -                                       expectedTos: expectedTos,
   1.259 -                                       expectedCcs: expectedCcs,
   1.260 -                                       expectedBccs: expectedBccs)
   1.261 -    }
   1.262 -
   1.263 -    /*
   1.264 -     From: Someone A To: someone B  CC: Me, someone C  BCC: --
   1.265 -     - ReplyAll Mailbox !~ [.sent, .drafts]:
   1.266 -     expected: From: Me X To: Someone A, someone_B,  CC: someone C
   1.267 -     */
   1.268 -    func testReplyAll_inbox_fromSomeoneA_toSomeoneB_ccSomeMeIncluded_bccNone() {
   1.269 -        let mode = ComposeUtil.ComposeMode.replyAll
   1.270 -        // Original message
   1.271 -        let folderType = FolderType.inbox
   1.272 -        let sender = someone_A
   1.273 -        let originalTos = [someone_B]
   1.274 -        let originalCcs = [meCurrentlyUsedAccount, someone_C]
   1.275 -        let originalBccs = noRecipients
   1.276 -        // Expected
   1.277 -        let expectedTos = [sender, someone_B]
   1.278 -        let expectedCcs =  [someone_C]
   1.279 -        let expectedBccs = noRecipients
   1.280 -
   1.281 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.282 -                                       originalMessageParentFolderType: folderType,
   1.283 -                                       originalFrom: sender,
   1.284 -                                       originalTos: originalTos,
   1.285 -                                       originalCcs: originalCcs,
   1.286 -                                       originalBccs: originalBccs,
   1.287 -                                       expectedTos: expectedTos,
   1.288 -                                       expectedCcs: expectedCcs,
   1.289 -                                       expectedBccs: expectedBccs)
   1.290 -    }
   1.291 -
   1.292 -    // MARK: FolderType == .sent
   1.293 -
   1.294 -    /*
   1.295 -     - ReplyAll Sent:
   1.296 -     from -> from, to -> to, cc -> cc
   1.297 -     */
   1.298 -    func testReplyAll_sent_fromSomeoneA_toMe_ccNone_bccNone() {
   1.299 -        let mode = ComposeUtil.ComposeMode.replyAll
   1.300 -        // Original message
   1.301 -        let folderType = FolderType.sent
   1.302 -        let sender = someone_A
   1.303 -        let originalTos = [meCurrentlyUsedAccount]
   1.304 -        let originalCcs = noRecipients
   1.305 -        let originalBccs = noRecipients
   1.306 -        // Expected
   1.307 -        let expectedTos = originalTos
   1.308 -        let expectedCcs = originalCcs
   1.309 -        let expectedBccs = originalBccs
   1.310 -
   1.311 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.312 -                                       originalMessageParentFolderType: folderType,
   1.313 -                                       originalFrom: sender,
   1.314 -                                       originalTos: originalTos,
   1.315 -                                       originalCcs: originalCcs,
   1.316 -                                       originalBccs: originalBccs,
   1.317 -                                       expectedTos: expectedTos,
   1.318 -                                       expectedCcs: expectedCcs,
   1.319 -                                       expectedBccs: expectedBccs)
   1.320 -    }
   1.321 -
   1.322 -    func testReplyAll_sent_fromSomeoneA_toSomeMeIncluded_ccNone_bccNone() {
   1.323 -        let mode = ComposeUtil.ComposeMode.replyAll
   1.324 -        // Original message
   1.325 -        let folderType = FolderType.sent
   1.326 -        let sender = someone_A
   1.327 -        let originalTos = [meCurrentlyUsedAccount, someone_B]
   1.328 -        let originalCcs = noRecipients
   1.329 -        let originalBccs = noRecipients
   1.330 -        // Expected
   1.331 -        let expectedTos = originalTos
   1.332 -        let expectedCcs = originalCcs
   1.333 -        let expectedBccs = originalBccs
   1.334 -
   1.335 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.336 -                                       originalMessageParentFolderType: folderType,
   1.337 -                                       originalFrom: sender,
   1.338 -                                       originalTos: originalTos,
   1.339 -                                       originalCcs: originalCcs,
   1.340 -                                       originalBccs: originalBccs,
   1.341 -                                       expectedTos: expectedTos,
   1.342 -                                       expectedCcs: expectedCcs,
   1.343 -                                       expectedBccs: expectedBccs)
   1.344 -    }
   1.345 -
   1.346 -    func testReplyAll_sent_fromSomeoneA_toMe_ccSomeMeNotIncluded_bccNone() {
   1.347 -        let mode = ComposeUtil.ComposeMode.replyAll
   1.348 -        // Original message
   1.349 -        let folderType = FolderType.sent
   1.350 -        let sender = someone_A
   1.351 -        let originalTos = [meCurrentlyUsedAccount]
   1.352 -        let originalCcs = [someone_B]
   1.353 -        let originalBccs = noRecipients
   1.354 -        // Expected
   1.355 -        let expectedTos = originalTos
   1.356 -        let expectedCcs = originalCcs
   1.357 -        let expectedBccs = originalBccs
   1.358 -
   1.359 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.360 -                                       originalMessageParentFolderType: folderType,
   1.361 -                                       originalFrom: sender,
   1.362 -                                       originalTos: originalTos,
   1.363 -                                       originalCcs: originalCcs,
   1.364 -                                       originalBccs: originalBccs,
   1.365 -                                       expectedTos: expectedTos,
   1.366 -                                       expectedCcs: expectedCcs,
   1.367 -                                       expectedBccs: expectedBccs)
   1.368 -    }
   1.369 -
   1.370 -    func testReplyAll_sent_fromSomeoneA_toSomeoneB_ccSomeMeIncluded_bccNone() {
   1.371 -        let mode = ComposeUtil.ComposeMode.replyAll
   1.372 -        // Original message
   1.373 -        let folderType = FolderType.sent
   1.374 -        let sender = someone_A
   1.375 -        let originalTos = [someone_B]
   1.376 -        let originalCcs = [meCurrentlyUsedAccount, someone_C]
   1.377 -        let originalBccs = noRecipients
   1.378 -        // Expected
   1.379 -        let expectedTos = originalTos
   1.380 -        let expectedCcs = originalCcs
   1.381 -        let expectedBccs = originalBccs
   1.382 -
   1.383 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.384 -                                       originalMessageParentFolderType: folderType,
   1.385 -                                       originalFrom: sender,
   1.386 -                                       originalTos: originalTos,
   1.387 -                                       originalCcs: originalCcs,
   1.388 -                                       originalBccs: originalBccs,
   1.389 -                                       expectedTos: expectedTos,
   1.390 -                                       expectedCcs: expectedCcs,
   1.391 -                                       expectedBccs: expectedBccs)
   1.392 -    }
   1.393 -
   1.394 -    // MARK: - Drafts
   1.395 -
   1.396 -    /*
   1.397 -     expected: testee == original message
   1.398 -     */
   1.399 -    func testNormal_Drafts_fromSomeoneA_toSomeMeIncluded_ccSome_bccSome() {
   1.400 -        let mode = ComposeUtil.ComposeMode.normal
   1.401 -        // Original message
   1.402 -        let folderType = FolderType.drafts
   1.403 -        let sender = meCurrentlyUsedAccount
   1.404 -        let originalTos = [meCurrentlyUsedAccount, someone_B]
   1.405 -        let originalCcs = [someone_B]
   1.406 -        let originalBccs = [someone_C]
   1.407 -        // Expected
   1.408 -        let expectedTos = originalTos
   1.409 -        let expectedCcs = originalCcs
   1.410 -        let expectedBccs = originalBccs
   1.411 -
   1.412 -        assertCorrectInitialRecipients(forReplyMode: mode,
   1.413 -                                       originalMessageParentFolderType: folderType,
   1.414 -                                       originalFrom: sender,
   1.415 -                                       originalTos: originalTos,
   1.416 -                                       originalCcs: originalCcs,
   1.417 -                                       originalBccs: originalBccs,
   1.418 -                                       expectedTos: expectedTos,
   1.419 -                                       expectedCcs: expectedCcs,
   1.420 -                                       expectedBccs: expectedBccs)
   1.421 -    }
   1.422 -
   1.423 -    // MARK: - HELPER
   1.424 -
   1.425 -    private func assertCorrectInitialRecipients(forReplyMode mode: ComposeUtil.ComposeMode,
   1.426 -                                                originalMessageParentFolderType type: FolderType,
   1.427 -                                                originalFrom: Identity,
   1.428 -                                                originalTos: [Identity],
   1.429 -                                                originalCcs: [Identity],
   1.430 -                                                originalBccs: [Identity],
   1.431 -                                                expectedTos: [Identity],
   1.432 -                                                expectedCcs: [Identity],
   1.433 -                                                expectedBccs: [Identity]) {
   1.434 -        let om = createOriginalMessage(inFolderOfType: type,
   1.435 -                                       from: originalFrom,
   1.436 -                                       tos: originalTos,
   1.437 -                                       ccs: originalCcs,
   1.438 -                                       bccs: originalBccs)
   1.439 -
   1.440 -        let expectedFrom = om.parent.account.user
   1.441 -
   1.442 -        assertRecipients(returnedForOriginalMessage: om,
   1.443 -                         inComposeMode: mode,
   1.444 -                         expectedFrom: expectedFrom,
   1.445 -                         expectedTos: expectedTos,
   1.446 -                         expectedCcs: expectedCcs,
   1.447 -                         expectedBccs: expectedBccs)
   1.448 -    }
   1.449 -
   1.450 -    private func assertRecipients(returnedForOriginalMessage om: Message,
   1.451 -                                  inComposeMode mode: ComposeUtil.ComposeMode,
   1.452 -                                  expectedFrom: Identity,
   1.453 -                                  expectedTos: [Identity]?,
   1.454 -                                  expectedCcs: [Identity]?,
   1.455 -                                  expectedBccs: [Identity]?) {
   1.456 -        // Testees
   1.457 -        let from = ComposeUtil.initialFrom(composeMode: mode, originalMessage: om)
   1.458 -        let tos = ComposeUtil.initialTos(composeMode: mode, originalMessage: om)
   1.459 -        let ccs = ComposeUtil.initialCcs(composeMode: mode, originalMessage: om)
   1.460 -        let bccs = ComposeUtil.initialBccs(composeMode: mode, originalMessage: om)
   1.461 -        // Assert
   1.462 -        XCTAssertEqual(from, expectedFrom)
   1.463 -        assertEqualRecipients(ids1: tos, ids2: expectedTos)
   1.464 -        assertEqualRecipients(ids1: ccs, ids2: expectedCcs)
   1.465 -        assertEqualRecipients(ids1: bccs, ids2: expectedBccs)
   1.466 -    }
   1.467 -
   1.468 -    private func assertEqualRecipients(ids1: [Identity]?, ids2: [Identity]?) {
   1.469 -        let ids1 = ids1 ?? [Identity]()
   1.470 -        let ids2 = ids2 ?? [Identity]()
   1.471 -        XCTAssertEqual(ids1.count, ids2.count)
   1.472 -
   1.473 -        let uniqueIds1 = Set(ids1)
   1.474 -        let uniqueIds2 = Set(ids2)
   1.475 -        XCTAssertEqual(uniqueIds1.count, uniqueIds2.count)
   1.476 -
   1.477 -        for id1 in uniqueIds1 {
   1.478 -            XCTAssertTrue(uniqueIds2.contains(id1))
   1.479 -        }
   1.480 -    }
   1.481 -
   1.482 -    private func createForeignIdentity(withId id: String) -> Identity {
   1.483 -        let createe = Identity(address: id + "@" + id + ".com",
   1.484 -                               userID: "TEST_ID_" + id,
   1.485 -                               addressBookID: nil,
   1.486 -                               userName: "TEST_USER_NAME_" + id,
   1.487 -                               isMySelf: false)
   1.488 -        return createe
   1.489 -    }
   1.490 -
   1.491 -    private func createOriginalMessage(inFolderOfType type: FolderType,
   1.492 -                                       from: Identity,
   1.493 -                                       tos: [Identity],
   1.494 -                                       ccs: [Identity],
   1.495 -                                       bccs: [Identity]) -> Message {
   1.496 -        guard let parentFolder = account.firstFolder(ofType: type) else {
   1.497 -            fatalError("No folder." +
   1.498 -                "Sorry, I had to crash here. The burn or buy bill would be too negative " +
   1.499 -                "returning an Optional ")
   1.500 -        }
   1.501 -        let createe = Message(uuid: MessageID.generate(), parentFolder: parentFolder)
   1.502 -        createe.from = from
   1.503 -        createe.replaceTo(with: tos)
   1.504 -        createe.replaceCc(with: ccs)
   1.505 -        createe.replaceBcc(with: bccs)
   1.506 -        let id = "Test Message - Created by ComposeUtilTest"
   1.507 -        createe.shortMessage = id
   1.508 -        createe.longMessage = id
   1.509 -
   1.510 -        return createe
   1.511 -    }
   1.512 -}
   1.513 +//class ComposeUtilTest: CoreDataDrivenTestBase {
   1.514 +//    var someone_A: Identity {
   1.515 +//        return createForeignIdentity(withId: "A")
   1.516 +//    }
   1.517 +//
   1.518 +//    var someone_B: Identity {
   1.519 +//        return createForeignIdentity(withId: "B")
   1.520 +//    }
   1.521 +//
   1.522 +//    var someone_C: Identity {
   1.523 +//        return createForeignIdentity(withId: "C")
   1.524 +//    }
   1.525 +//
   1.526 +//    var meCurrentlyUsedAccount: Identity {
   1.527 +//        return account.user
   1.528 +//    }
   1.529 +//
   1.530 +//    let noRecipients = [Identity]()
   1.531 +//
   1.532 +//    var meSomeUnusedAccount: Identity!
   1.533 +//
   1.534 +//    override func setUp() {
   1.535 +//        super.setUp()
   1.536 +//        cdAccount.createRequiredFoldersAndWait(testCase: self)
   1.537 +//        meSomeUnusedAccount = SecretTestData().createWorkingAccount(number: 1).user
   1.538 +//    }
   1.539 +//
   1.540 +//    // MARK: - REPLY
   1.541 +//
   1.542 +//    // MARK: FolderType !~ [.sent, .draft]
   1.543 +//
   1.544 +//    /*
   1.545 +//     1) From: Someone A To: Me X CC: ANY
   1.546 +//     - Reply Any Mailbox != sent:
   1.547 +//     algo: from -> to, to -> from
   1.548 +//     result: From: Me X To: Someone A CC: -- BCC: --
   1.549 +//     */
   1.550 +//    func testReply_inbox_fromSomeoneA_toMe_ccNone_bccNone() {
   1.551 +//        let mode = ComposeUtil.ComposeMode.replyFrom
   1.552 +//        // Original message
   1.553 +//        let folderType = FolderType.inbox
   1.554 +//        let sender = someone_A
   1.555 +//        let originalTos = [meCurrentlyUsedAccount]
   1.556 +//        let originalCcs = noRecipients
   1.557 +//        let originalBccs = noRecipients
   1.558 +//        // Expected
   1.559 +//        let expectedTos = [sender]
   1.560 +//        let expectedCcs = noRecipients
   1.561 +//        let expectedBccs = noRecipients
   1.562 +//
   1.563 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.564 +//                                       originalMessageParentFolderType: folderType,
   1.565 +//                                       originalFrom: sender,
   1.566 +//                                       originalTos: originalTos,
   1.567 +//                                       originalCcs: originalCcs,
   1.568 +//                                       originalBccs: originalBccs,
   1.569 +//                                       expectedTos: expectedTos,
   1.570 +//                                       expectedCcs: expectedCcs,
   1.571 +//                                       expectedBccs: expectedBccs)
   1.572 +//    }
   1.573 +//
   1.574 +//    func testReply_inbox_fromSomeoneA_toMe_ccSome_bccSome() {
   1.575 +//        let mode = ComposeUtil.ComposeMode.replyFrom
   1.576 +//        // Original message
   1.577 +//        let folderType = FolderType.inbox
   1.578 +//        let sender = someone_A
   1.579 +//        let originalTos = [meCurrentlyUsedAccount]
   1.580 +//        let originalCcs = [someone_B]
   1.581 +//        let originalBccs = [someone_C]
   1.582 +//        // Expected
   1.583 +//        let expectedTos = [sender]
   1.584 +//        let expectedCcs = noRecipients
   1.585 +//        let expectedBccs = noRecipients
   1.586 +//
   1.587 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.588 +//                                       originalMessageParentFolderType: folderType,
   1.589 +//                                       originalFrom: sender,
   1.590 +//                                       originalTos: originalTos,
   1.591 +//                                       originalCcs: originalCcs,
   1.592 +//                                       originalBccs: originalBccs,
   1.593 +//                                       expectedTos: expectedTos,
   1.594 +//                                       expectedCcs: expectedCcs,
   1.595 +//                                       expectedBccs: expectedBccs)
   1.596 +//    }
   1.597 +//
   1.598 +//    // MARK: FolderType == .sent
   1.599 +//
   1.600 +//    /*
   1.601 +//     1) From: Me X To: Someone A CC: ANY BCC:. ANY
   1.602 +//     - Reply Any Mailbox == sent:
   1.603 +//     algo: from -> from, to -> to
   1.604 +//     result: From: Me X To: Someone A CC: -- BCC: --
   1.605 +//     */
   1.606 +//    func testReply_sent_fromSomeoneA_toMe_ccNone_bccNone() {
   1.607 +//        let mode = ComposeUtil.ComposeMode.replyFrom
   1.608 +//        // Original message
   1.609 +//        let folderType = FolderType.sent
   1.610 +//        let sender = meCurrentlyUsedAccount
   1.611 +//        let originalTos = [someone_A]
   1.612 +//        let originalCcs = noRecipients
   1.613 +//        let originalBccs = noRecipients
   1.614 +//        // Expected
   1.615 +//        let expectedTos = originalTos
   1.616 +//        let expectedCcs = noRecipients
   1.617 +//        let expectedBccs = noRecipients
   1.618 +//
   1.619 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.620 +//                                       originalMessageParentFolderType: folderType,
   1.621 +//                                       originalFrom: sender,
   1.622 +//                                       originalTos: originalTos,
   1.623 +//                                       originalCcs: originalCcs,
   1.624 +//                                       originalBccs: originalBccs,
   1.625 +//                                       expectedTos: expectedTos,
   1.626 +//                                       expectedCcs: expectedCcs,
   1.627 +//                                       expectedBccs: expectedBccs)
   1.628 +//    }
   1.629 +//
   1.630 +//    func testReply_sent_fromSomeoneA_toMe_ccSome_bccSome() {
   1.631 +//        let mode = ComposeUtil.ComposeMode.replyFrom
   1.632 +//        // Original message
   1.633 +//        let folderType = FolderType.sent
   1.634 +//        let sender = meCurrentlyUsedAccount
   1.635 +//        let originalTos = [someone_A]
   1.636 +//        let originalCcs = [someone_B]
   1.637 +//        let originalBccs = [someone_C]
   1.638 +//        // Expected
   1.639 +//        let expectedTos = originalTos
   1.640 +//        let expectedCcs = noRecipients
   1.641 +//        let expectedBccs = noRecipients
   1.642 +//
   1.643 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.644 +//                                       originalMessageParentFolderType: folderType,
   1.645 +//                                       originalFrom: sender,
   1.646 +//                                       originalTos: originalTos,
   1.647 +//                                       originalCcs: originalCcs,
   1.648 +//                                       originalBccs: originalBccs,
   1.649 +//                                       expectedTos: expectedTos,
   1.650 +//                                       expectedCcs: expectedCcs,
   1.651 +//                                       expectedBccs: expectedBccs)
   1.652 +//    }
   1.653 +//
   1.654 +//    // MARK: - REPLY ALL
   1.655 +//
   1.656 +//     // MARK: FolderType !~ [.sent, .draft]
   1.657 +//
   1.658 +//    /*
   1.659 +//     From: Someone A To: Me X  CC: -- BCC: --
   1.660 +//     - ReplyAll Mailbox !~ [.sent, .drafts]:
   1.661 +//     algo: from -> me, to = from + (origTos - me)
   1.662 +//     expected: From: Me X To: Someone A  CC: -- BCC: --
   1.663 +//     */
   1.664 +//    func testReplyAll_inbox_fromSomeoneA_toMe_ccNone_bccNone() {
   1.665 +//        let mode = ComposeUtil.ComposeMode.replyAll
   1.666 +//        // Original message
   1.667 +//        let folderType = FolderType.inbox
   1.668 +//        let sender = someone_A
   1.669 +//        let originalTos = [meCurrentlyUsedAccount]
   1.670 +//        let originalCcs = noRecipients
   1.671 +//        let originalBccs = noRecipients
   1.672 +//        // Expected
   1.673 +//        let expectedTos = [sender]
   1.674 +//        let expectedCcs = noRecipients
   1.675 +//        let expectedBccs = noRecipients
   1.676 +//
   1.677 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.678 +//                                       originalMessageParentFolderType: folderType,
   1.679 +//                                       originalFrom: sender,
   1.680 +//                                       originalTos: originalTos,
   1.681 +//                                       originalCcs: originalCcs,
   1.682 +//                                       originalBccs: originalBccs,
   1.683 +//                                       expectedTos: expectedTos,
   1.684 +//                                       expectedCcs: expectedCcs,
   1.685 +//                                       expectedBccs: expectedBccs)
   1.686 +//    }
   1.687 +//
   1.688 +//    /*
   1.689 +//     From: Someone A To: Me X, someone B CC: -- BCC: --
   1.690 +//     - ReplyAll Mailbox !~ [.sent, .drafts]:
   1.691 +//     algo: from -> me, to = from + (origTos - me)
   1.692 +//     expected: From: Me X To: Someone A, someone B CC: --
   1.693 +//     */
   1.694 +//    func testReplyAll_inbox_fromSomeoneA_toSomeMeIncluded_ccNone_bccNone() {
   1.695 +//        let mode = ComposeUtil.ComposeMode.replyAll
   1.696 +//        // Original message
   1.697 +//        let folderType = FolderType.inbox
   1.698 +//        let sender = someone_A
   1.699 +//        let originalTos = [meCurrentlyUsedAccount, someone_B]
   1.700 +//        let originalCcs = noRecipients
   1.701 +//        let originalBccs = noRecipients
   1.702 +//        // Expected
   1.703 +//        let expectedTos = [sender, someone_B]
   1.704 +//        let expectedCcs = noRecipients
   1.705 +//        let expectedBccs = noRecipients
   1.706 +//
   1.707 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.708 +//                                       originalMessageParentFolderType: folderType,
   1.709 +//                                       originalFrom: sender,
   1.710 +//                                       originalTos: originalTos,
   1.711 +//                                       originalCcs: originalCcs,
   1.712 +//                                       originalBccs: originalBccs,
   1.713 +//                                       expectedTos: expectedTos,
   1.714 +//                                       expectedCcs: expectedCcs,
   1.715 +//                                       expectedBccs: expectedBccs)
   1.716 +//    }
   1.717 +//
   1.718 +//    /*
   1.719 +//     From: Someone A To: Me X  CC: someone B  BCC: --
   1.720 +//     - ReplyAll Mailbox !~ [.sent, .drafts]:
   1.721 +//     expected: From: Me X To: Someone A,  CC: someone B
   1.722 +//     */
   1.723 +//    func testReplyAll_inbox_fromSomeoneA_toMe_ccSomeMeNotIncluded_bccNone() {
   1.724 +//        let mode = ComposeUtil.ComposeMode.replyAll
   1.725 +//        // Original message
   1.726 +//        let folderType = FolderType.inbox
   1.727 +//        let sender = someone_A
   1.728 +//        let originalTos = [meCurrentlyUsedAccount]
   1.729 +//        let originalCcs = [someone_B]
   1.730 +//        let originalBccs = noRecipients
   1.731 +//        // Expected
   1.732 +//        let expectedTos = [sender]
   1.733 +//        let expectedCcs = originalCcs
   1.734 +//        let expectedBccs = noRecipients
   1.735 +//
   1.736 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.737 +//                                       originalMessageParentFolderType: folderType,
   1.738 +//                                       originalFrom: sender,
   1.739 +//                                       originalTos: originalTos,
   1.740 +//                                       originalCcs: originalCcs,
   1.741 +//                                       originalBccs: originalBccs,
   1.742 +//                                       expectedTos: expectedTos,
   1.743 +//                                       expectedCcs: expectedCcs,
   1.744 +//                                       expectedBccs: expectedBccs)
   1.745 +//    }
   1.746 +//
   1.747 +//    /*
   1.748 +//     From: Someone A To: someone B  CC: Me, someone C  BCC: --
   1.749 +//     - ReplyAll Mailbox !~ [.sent, .drafts]:
   1.750 +//     expected: From: Me X To: Someone A, someone_B,  CC: someone C
   1.751 +//     */
   1.752 +//    func testReplyAll_inbox_fromSomeoneA_toSomeoneB_ccSomeMeIncluded_bccNone() {
   1.753 +//        let mode = ComposeUtil.ComposeMode.replyAll
   1.754 +//        // Original message
   1.755 +//        let folderType = FolderType.inbox
   1.756 +//        let sender = someone_A
   1.757 +//        let originalTos = [someone_B]
   1.758 +//        let originalCcs = [meCurrentlyUsedAccount, someone_C]
   1.759 +//        let originalBccs = noRecipients
   1.760 +//        // Expected
   1.761 +//        let expectedTos = [sender, someone_B]
   1.762 +//        let expectedCcs =  [someone_C]
   1.763 +//        let expectedBccs = noRecipients
   1.764 +//
   1.765 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.766 +//                                       originalMessageParentFolderType: folderType,
   1.767 +//                                       originalFrom: sender,
   1.768 +//                                       originalTos: originalTos,
   1.769 +//                                       originalCcs: originalCcs,
   1.770 +//                                       originalBccs: originalBccs,
   1.771 +//                                       expectedTos: expectedTos,
   1.772 +//                                       expectedCcs: expectedCcs,
   1.773 +//                                       expectedBccs: expectedBccs)
   1.774 +//    }
   1.775 +//
   1.776 +//    // MARK: FolderType == .sent
   1.777 +//
   1.778 +//    /*
   1.779 +//     - ReplyAll Sent:
   1.780 +//     from -> from, to -> to, cc -> cc
   1.781 +//     */
   1.782 +//    func testReplyAll_sent_fromSomeoneA_toMe_ccNone_bccNone() {
   1.783 +//        let mode = ComposeUtil.ComposeMode.replyAll
   1.784 +//        // Original message
   1.785 +//        let folderType = FolderType.sent
   1.786 +//        let sender = someone_A
   1.787 +//        let originalTos = [meCurrentlyUsedAccount]
   1.788 +//        let originalCcs = noRecipients
   1.789 +//        let originalBccs = noRecipients
   1.790 +//        // Expected
   1.791 +//        let expectedTos = originalTos
   1.792 +//        let expectedCcs = originalCcs
   1.793 +//        let expectedBccs = originalBccs
   1.794 +//
   1.795 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.796 +//                                       originalMessageParentFolderType: folderType,
   1.797 +//                                       originalFrom: sender,
   1.798 +//                                       originalTos: originalTos,
   1.799 +//                                       originalCcs: originalCcs,
   1.800 +//                                       originalBccs: originalBccs,
   1.801 +//                                       expectedTos: expectedTos,
   1.802 +//                                       expectedCcs: expectedCcs,
   1.803 +//                                       expectedBccs: expectedBccs)
   1.804 +//    }
   1.805 +//
   1.806 +//    func testReplyAll_sent_fromSomeoneA_toSomeMeIncluded_ccNone_bccNone() {
   1.807 +//        let mode = ComposeUtil.ComposeMode.replyAll
   1.808 +//        // Original message
   1.809 +//        let folderType = FolderType.sent
   1.810 +//        let sender = someone_A
   1.811 +//        let originalTos = [meCurrentlyUsedAccount, someone_B]
   1.812 +//        let originalCcs = noRecipients
   1.813 +//        let originalBccs = noRecipients
   1.814 +//        // Expected
   1.815 +//        let expectedTos = originalTos
   1.816 +//        let expectedCcs = originalCcs
   1.817 +//        let expectedBccs = originalBccs
   1.818 +//
   1.819 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.820 +//                                       originalMessageParentFolderType: folderType,
   1.821 +//                                       originalFrom: sender,
   1.822 +//                                       originalTos: originalTos,
   1.823 +//                                       originalCcs: originalCcs,
   1.824 +//                                       originalBccs: originalBccs,
   1.825 +//                                       expectedTos: expectedTos,
   1.826 +//                                       expectedCcs: expectedCcs,
   1.827 +//                                       expectedBccs: expectedBccs)
   1.828 +//    }
   1.829 +//
   1.830 +//    func testReplyAll_sent_fromSomeoneA_toMe_ccSomeMeNotIncluded_bccNone() {
   1.831 +//        let mode = ComposeUtil.ComposeMode.replyAll
   1.832 +//        // Original message
   1.833 +//        let folderType = FolderType.sent
   1.834 +//        let sender = someone_A
   1.835 +//        let originalTos = [meCurrentlyUsedAccount]
   1.836 +//        let originalCcs = [someone_B]
   1.837 +//        let originalBccs = noRecipients
   1.838 +//        // Expected
   1.839 +//        let expectedTos = originalTos
   1.840 +//        let expectedCcs = originalCcs
   1.841 +//        let expectedBccs = originalBccs
   1.842 +//
   1.843 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.844 +//                                       originalMessageParentFolderType: folderType,
   1.845 +//                                       originalFrom: sender,
   1.846 +//                                       originalTos: originalTos,
   1.847 +//                                       originalCcs: originalCcs,
   1.848 +//                                       originalBccs: originalBccs,
   1.849 +//                                       expectedTos: expectedTos,
   1.850 +//                                       expectedCcs: expectedCcs,
   1.851 +//                                       expectedBccs: expectedBccs)
   1.852 +//    }
   1.853 +//
   1.854 +//    func testReplyAll_sent_fromSomeoneA_toSomeoneB_ccSomeMeIncluded_bccNone() {
   1.855 +//        let mode = ComposeUtil.ComposeMode.replyAll
   1.856 +//        // Original message
   1.857 +//        let folderType = FolderType.sent
   1.858 +//        let sender = someone_A
   1.859 +//        let originalTos = [someone_B]
   1.860 +//        let originalCcs = [meCurrentlyUsedAccount, someone_C]
   1.861 +//        let originalBccs = noRecipients
   1.862 +//        // Expected
   1.863 +//        let expectedTos = originalTos
   1.864 +//        let expectedCcs = originalCcs
   1.865 +//        let expectedBccs = originalBccs
   1.866 +//
   1.867 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.868 +//                                       originalMessageParentFolderType: folderType,
   1.869 +//                                       originalFrom: sender,
   1.870 +//                                       originalTos: originalTos,
   1.871 +//                                       originalCcs: originalCcs,
   1.872 +//                                       originalBccs: originalBccs,
   1.873 +//                                       expectedTos: expectedTos,
   1.874 +//                                       expectedCcs: expectedCcs,
   1.875 +//                                       expectedBccs: expectedBccs)
   1.876 +//    }
   1.877 +//
   1.878 +//    // MARK: - Drafts
   1.879 +//
   1.880 +//    /*
   1.881 +//     expected: testee == original message
   1.882 +//     */
   1.883 +//    func testNormal_Drafts_fromSomeoneA_toSomeMeIncluded_ccSome_bccSome() {
   1.884 +//        let mode = ComposeUtil.ComposeMode.normal
   1.885 +//        // Original message
   1.886 +//        let folderType = FolderType.drafts
   1.887 +//        let sender = meCurrentlyUsedAccount
   1.888 +//        let originalTos = [meCurrentlyUsedAccount, someone_B]
   1.889 +//        let originalCcs = [someone_B]
   1.890 +//        let originalBccs = [someone_C]
   1.891 +//        // Expected
   1.892 +//        let expectedTos = originalTos
   1.893 +//        let expectedCcs = originalCcs
   1.894 +//        let expectedBccs = originalBccs
   1.895 +//
   1.896 +//        assertCorrectInitialRecipients(forReplyMode: mode,
   1.897 +//                                       originalMessageParentFolderType: folderType,
   1.898 +//                                       originalFrom: sender,
   1.899 +//                                       originalTos: originalTos,
   1.900 +//                                       originalCcs: originalCcs,
   1.901 +//                                       originalBccs: originalBccs,
   1.902 +//                                       expectedTos: expectedTos,
   1.903 +//                                       expectedCcs: expectedCcs,
   1.904 +//                                       expectedBccs: expectedBccs)
   1.905 +//    }
   1.906 +//
   1.907 +//    // MARK: - HELPER
   1.908 +//
   1.909 +//    private func assertCorrectInitialRecipients(forReplyMode mode: ComposeUtil.ComposeMode,
   1.910 +//                                                originalMessageParentFolderType type: FolderType,
   1.911 +//                                                originalFrom: Identity,
   1.912 +//                                                originalTos: [Identity],
   1.913 +//                                                originalCcs: [Identity],
   1.914 +//                                                originalBccs: [Identity],
   1.915 +//                                                expectedTos: [Identity],
   1.916 +//                                                expectedCcs: [Identity],
   1.917 +//                                                expectedBccs: [Identity]) {
   1.918 +//        let om = createOriginalMessage(inFolderOfType: type,
   1.919 +//                                       from: originalFrom,
   1.920 +//                                       tos: originalTos,
   1.921 +//                                       ccs: originalCcs,
   1.922 +//                                       bccs: originalBccs)
   1.923 +//
   1.924 +//        let expectedFrom = om.parent.account.user
   1.925 +//
   1.926 +//        assertRecipients(returnedForOriginalMessage: om,
   1.927 +//                         inComposeMode: mode,
   1.928 +//                         expectedFrom: expectedFrom,
   1.929 +//                         expectedTos: expectedTos,
   1.930 +//                         expectedCcs: expectedCcs,
   1.931 +//                         expectedBccs: expectedBccs)
   1.932 +//    }
   1.933 +//
   1.934 +//    private func assertRecipients(returnedForOriginalMessage om: Message,
   1.935 +//                                  inComposeMode mode: ComposeUtil.ComposeMode,
   1.936 +//                                  expectedFrom: Identity,
   1.937 +//                                  expectedTos: [Identity]?,
   1.938 +//                                  expectedCcs: [Identity]?,
   1.939 +//                                  expectedBccs: [Identity]?) {
   1.940 +//        // Testees
   1.941 +//        let from = ComposeUtil.initialFrom(composeMode: mode, originalMessage: om)
   1.942 +//        let tos = ComposeUtil.initialTos(composeMode: mode, originalMessage: om)
   1.943 +//        let ccs = ComposeUtil.initialCcs(composeMode: mode, originalMessage: om)
   1.944 +//        let bccs = ComposeUtil.initialBccs(composeMode: mode, originalMessage: om)
   1.945 +//        // Assert
   1.946 +//        XCTAssertEqual(from, expectedFrom)
   1.947 +//        assertEqualRecipients(ids1: tos, ids2: expectedTos)
   1.948 +//        assertEqualRecipients(ids1: ccs, ids2: expectedCcs)
   1.949 +//        assertEqualRecipients(ids1: bccs, ids2: expectedBccs)
   1.950 +//    }
   1.951 +//
   1.952 +//    private func assertEqualRecipients(ids1: [Identity]?, ids2: [Identity]?) {
   1.953 +//        let ids1 = ids1 ?? [Identity]()
   1.954 +//        let ids2 = ids2 ?? [Identity]()
   1.955 +//        XCTAssertEqual(ids1.count, ids2.count)
   1.956 +//
   1.957 +//        let uniqueIds1 = Set(ids1)
   1.958 +//        let uniqueIds2 = Set(ids2)
   1.959 +//        XCTAssertEqual(uniqueIds1.count, uniqueIds2.count)
   1.960 +//
   1.961 +//        for id1 in uniqueIds1 {
   1.962 +//            XCTAssertTrue(uniqueIds2.contains(id1))
   1.963 +//        }
   1.964 +//    }
   1.965 +//
   1.966 +//    private func createForeignIdentity(withId id: String) -> Identity {
   1.967 +//        let createe = Identity(address: id + "@" + id + ".com",
   1.968 +//                               userID: "TEST_ID_" + id,
   1.969 +//                               addressBookID: nil,
   1.970 +//                               userName: "TEST_USER_NAME_" + id,
   1.971 +//                               isMySelf: false)
   1.972 +//        return createe
   1.973 +//    }
   1.974 +//
   1.975 +//    private func createOriginalMessage(inFolderOfType type: FolderType,
   1.976 +//                                       from: Identity,
   1.977 +//                                       tos: [Identity],
   1.978 +//                                       ccs: [Identity],
   1.979 +//                                       bccs: [Identity]) -> Message {
   1.980 +//        guard let parentFolder = account.firstFolder(ofType: type) else {
   1.981 +//            fatalError("No folder." +
   1.982 +//                "Sorry, I had to crash here. The burn or buy bill would be too negative " +
   1.983 +//                "returning an Optional ")
   1.984 +//        }
   1.985 +//        let createe = Message(uuid: MessageID.generate(), parentFolder: parentFolder)
   1.986 +//        createe.from = from
   1.987 +//        createe.replaceTo(with: tos)
   1.988 +//        createe.replaceCc(with: ccs)
   1.989 +//        createe.replaceBcc(with: bccs)
   1.990 +//        let id = "Test Message - Created by ComposeUtilTest"
   1.991 +//        createe.shortMessage = id
   1.992 +//        createe.longMessage = id
   1.993 +//
   1.994 +//        return createe
   1.995 +//    }
   1.996 +//}