mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Fix test
// FREEBIE
This commit is contained in:
parent
91785e5590
commit
23a2a5e5f3
@ -5,12 +5,11 @@ import android.content.Context;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.thoughtcrime.securesms.BaseUnitTest;
|
import org.thoughtcrime.securesms.BaseUnitTest;
|
||||||
import org.thoughtcrime.securesms.database.AttachmentDatabase.AttachmentId;
|
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||||
|
import org.thoughtcrime.securesms.attachments.AttachmentId;
|
||||||
import org.thoughtcrime.securesms.jobs.AttachmentDownloadJob.InvalidPartException;
|
import org.thoughtcrime.securesms.jobs.AttachmentDownloadJob.InvalidPartException;
|
||||||
import org.thoughtcrime.securesms.util.Util;
|
|
||||||
|
|
||||||
import ws.com.google.android.mms.pdu.PduPart;
|
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
import static org.powermock.api.mockito.PowerMockito.mock;
|
import static org.powermock.api.mockito.PowerMockito.mock;
|
||||||
|
|
||||||
public class AttachmentDownloadJobTest extends BaseUnitTest {
|
public class AttachmentDownloadJobTest extends BaseUnitTest {
|
||||||
@ -25,15 +24,19 @@ public class AttachmentDownloadJobTest extends BaseUnitTest {
|
|||||||
|
|
||||||
@Test(expected = InvalidPartException.class)
|
@Test(expected = InvalidPartException.class)
|
||||||
public void testCreateAttachmentPointerInvalidId() throws Exception {
|
public void testCreateAttachmentPointerInvalidId() throws Exception {
|
||||||
PduPart part = new PduPart();
|
Attachment attachment = mock(Attachment.class);
|
||||||
part.setContentDisposition(Util.toIsoBytes("a long and acceptable valid key like we all want"));
|
when(attachment.getLocation()).thenReturn(null);
|
||||||
job.createAttachmentPointer(masterSecret, part);
|
when(attachment.getKey()).thenReturn("a long and acceptable valid key like we all want");
|
||||||
|
|
||||||
|
job.createAttachmentPointer(masterSecret, attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = InvalidPartException.class)
|
@Test(expected = InvalidPartException.class)
|
||||||
public void testCreateAttachmentPointerInvalidKey() throws Exception {
|
public void testCreateAttachmentPointerInvalidKey() throws Exception {
|
||||||
PduPart part = new PduPart();
|
Attachment attachment = mock(Attachment.class);
|
||||||
part.setContentDisposition(Util.toIsoBytes("1"));
|
when(attachment.getLocation()).thenReturn("something");
|
||||||
job.createAttachmentPointer(masterSecret, part);
|
when(attachment.getKey()).thenReturn(null);
|
||||||
|
|
||||||
|
job.createAttachmentPointer(masterSecret, attachment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user