Repository: thunderbird/thunderbird-android
File: mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/SearchResponseTest.kt (Kotlin)

Code before:
package com.fsck.k9.mail.store.imap

import com.fsck.k9.mail.store.imap.SearchResponse.Companion.parse
import org.junit.Assert
import org.junit.Test

class SearchResponseTest {
    @Test
    @Throws(Exception::class)
    fun parse_withSingleSearchResponse_shouldExtractNumbers() {
        val imapResponses = ImapResponseHelper.createImapResponseList(
            "* SEARCH 1 2 3",
            "* 23 EXISTS",
            "* SEARCH 4",
            "1 OK SEARCH completed",
        )

        val result = parse(imapResponses)

        Assert.assertNotNull(result)
        Assert.assertEquals(mutableListOf(1L, 2L, 3L, 4L), result.numbers)
    }

    @Test
    @Throws(Exception::class)
    fun parse_withMultipleSearchResponses_shouldExtractNumbers() {
        val imapResponses = ImapResponseHelper.createImapResponseList(
            "* SEARCH 1 2 3",
            "* 23 EXISTS",
            "* SEARCH 4",
            "1 OK SEARCH completed",
            "* SEARCH 5 6",
            "* 19 EXPUNGED",
            "* SEARCH 7",
            "2 OK SEARCH completed",
            "* SEARCH 8",
            "3 OK SEARCH completed",
        )

        val result = parse(imapResponses)

        Assert.assertNotNull(result)
        Assert.assertEquals(mutableListOf(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L), result.numbers)
    }

    @Test

Review comment (refactor):
NIT: I understand you are converting the test case from Java to Kotlin, but I see a great opportunity to also migrate this to use AssertK and adopt our new test guidelines.

If you are interested in doing so, here is how this current test case would look:
```kotlin
    @Test
    fun parse_withSingleSearchResponse_shouldExtractNumbers() {
        // Arrange
        val imapResponses = ImapResponseHelper.createImapResponseList(
            "* SEARCH 1 2 3",
            "* 23 EXISTS",
            "* SEARCH 4",
            "1 OK SEARCH completed",
        )

        // Act
        val result = parse(imapResponses)

        // Assert
        assertThat(result).all {
            isNotNull()
            prop("numbers") { it.numbers }
                .containsExactly(1L, 2L, 3L, 4L)
        }
}
```

If you decide to, please apply the same to the other test cases and make it in a new commit.

Code after:
package com.fsck.k9.mail.store.imap

import assertk.all
import assertk.assertThat
import assertk.assertions.containsExactly
import assertk.assertions.isEmpty
import assertk.assertions.prop
import com.fsck.k9.mail.store.imap.SearchResponse.Companion.parse
import jdk.dynalink.linker.support.Guards.isNotNull
import kotlin.test.Test
import org.junit.Assert

class SearchResponseTest {
    @Test
    fun parse_withSingleSearchResponse_shouldExtractNumbers() {
        // Arrange
        val imapResponses = ImapResponseHelper.createImapResponseList(
            "* SEARCH 1 2 3",
            "* 23 EXISTS",
            "* SEARCH 4",
            "1 OK SEARCH completed",
        )

        // Act
        val result = parse(imapResponses)

        // Assert
        assertThat(result).all {
            isNotNull()
            prop("numbers") { it.numbers }
                .containsExactly(1L, 2L, 3L, 4L)
        }
    }

    @Test
    fun parse_withMultipleSearchResponses_shouldExtractNumbers() {
        // Arrange
        val imapResponses = ImapResponseHelper.createImapResponseList(
            "* SEARCH 1 2 3",
            "* 23 EXISTS",
            "* SEARCH 4",
            "1 OK SEARCH completed",
            "* SEARCH 5 6",
            "* 19 EXPUNGED",
            "* SEARCH 7",
            "2 OK SEARCH completed",