use of com.fsck.k9.message.SimpleMessageBuilder in project k-9 by k9mail.
the class MessageBuilderTest method buildWithException_shouldThrow.
@Test
public void buildWithException_shouldThrow() throws MessagingException {
MessageBuilder messageBuilder = new SimpleMessageBuilder(context, messageIdGenerator, boundaryGenerator) {
@Override
protected void buildMessageInternal() {
queueMessageBuildException(new MessagingException("expected error"));
}
};
messageBuilder.buildAsync(callback);
verify(callback).onMessageBuildException(any(MessagingException.class));
verifyNoMoreInteractions(callback);
}
use of com.fsck.k9.message.SimpleMessageBuilder in project k-9 by k9mail.
the class SimpleMessageBuilder method newInstance.
public static SimpleMessageBuilder newInstance() {
Context context = Globals.getContext();
MessageIdGenerator messageIdGenerator = MessageIdGenerator.getInstance();
BoundaryGenerator boundaryGenerator = BoundaryGenerator.getInstance();
return new SimpleMessageBuilder(context, messageIdGenerator, boundaryGenerator);
}
use of com.fsck.k9.message.SimpleMessageBuilder in project k-9 by k9mail.
the class MessageBuilderTest method buildWithException_detachAndReattach_shouldThrow.
@Test
public void buildWithException_detachAndReattach_shouldThrow() throws MessagingException {
Callback anotherCallback = mock(Callback.class);
MessageBuilder messageBuilder = new SimpleMessageBuilder(context, messageIdGenerator, boundaryGenerator) {
@Override
protected void buildMessageInternal() {
queueMessageBuildException(new MessagingException("expected error"));
}
};
Robolectric.getBackgroundThreadScheduler().pause();
messageBuilder.buildAsync(callback);
messageBuilder.detachCallback();
Robolectric.getBackgroundThreadScheduler().unPause();
messageBuilder.reattachCallback(anotherCallback);
verifyNoMoreInteractions(callback);
verify(anotherCallback).onMessageBuildException(any(MessagingException.class));
verifyNoMoreInteractions(anotherCallback);
}
Aggregations