Don't call open()
from RealImapFolder.appendMessages()
This commit is contained in:
parent
874b06f415
commit
94e0ced621
2 changed files with 13 additions and 1 deletions
|
@ -964,7 +964,6 @@ internal class RealImapFolder(
|
|||
*/
|
||||
@Throws(MessagingException::class)
|
||||
override fun appendMessages(messages: List<Message>): Map<String, String>? {
|
||||
open(OpenMode.READ_WRITE)
|
||||
checkOpen()
|
||||
|
||||
return try {
|
||||
|
|
|
@ -994,6 +994,19 @@ class RealImapFolderTest {
|
|||
assertThat(buffer.readUtf8()).isEqualTo("text")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `appendMessages() on closed folder should throw`() {
|
||||
val folder = createFolder("Folder")
|
||||
val messages = listOf(createImapMessage("1"))
|
||||
|
||||
assertFailure {
|
||||
folder.appendMessages(messages)
|
||||
}.isInstanceOf<MessagingException>()
|
||||
.hasMessage("Folder Folder is not open.")
|
||||
|
||||
verifyNoMoreInteractions(imapConnection)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun appendMessages_shouldIssueRespectiveCommand() {
|
||||
val folder = createFolder("Folder")
|
||||
|
|
Loading…
Reference in a new issue