we don't use displayName from database either (for now), fix tests to reflect that

This commit is contained in:
Vincent Breitmoser 2016-07-04 17:51:23 +02:00
parent 7cb6fa102f
commit 0e3d18e7f7
5 changed files with 5 additions and 17 deletions

View file

@ -9,16 +9,14 @@ public class LocalBodyPart extends MimeBodyPart implements LocalPart {
private final String accountUuid;
private final LocalMessage message;
private final long messagePartId;
private final String displayName;
private final long size;
public LocalBodyPart(String accountUuid, LocalMessage message, long messagePartId, String displayName, long size)
public LocalBodyPart(String accountUuid, LocalMessage message, long messagePartId, long size)
throws MessagingException {
super();
this.accountUuid = accountUuid;
this.message = message;
this.messagePartId = messagePartId;
this.displayName = displayName;
this.size = size;
}
@ -32,11 +30,6 @@ public class LocalBodyPart extends MimeBodyPart implements LocalPart {
return messagePartId;
}
@Override
public String getDisplayName() {
return displayName;
}
@Override
public long getSize() {
return size;

View file

@ -712,11 +712,12 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
long parentId = cursor.getLong(2);
String mimeType = cursor.getString(3);
long size = cursor.getLong(4);
String displayName = cursor.getString(5);
byte[] header = cursor.getBlob(6);
int dataLocation = cursor.getInt(9);
String serverExtra = cursor.getString(15);
// TODO we don't currently cache the part types. might want to do that at a later point?
// TODO we don't currently cache much of the part data which is computed with AttachmentInfoExtractor,
// TODO might want to do that at a later point?
// String displayName = cursor.getString(5);
// int type = cursor.getInt(1);
// boolean firstClassAttachment = (type != MessagePartType.HIDDEN_ATTACHMENT);
@ -731,7 +732,7 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
String parentMimeType = parentPart.getMimeType();
if (MimeUtility.isMultipart(parentMimeType)) {
BodyPart bodyPart = new LocalBodyPart(getAccountUuid(), message, id, displayName, size);
BodyPart bodyPart = new LocalBodyPart(getAccountUuid(), message, id, size);
((Multipart) parentPart.getBody()).addBodyPart(bodyPart);
part = bodyPart;
} else if (MimeUtility.isMessage(parentMimeType)) {

View file

@ -4,7 +4,6 @@ package com.fsck.k9.mailstore;
public interface LocalPart {
String getAccountUuid();
long getId();
String getDisplayName();
long getSize();
LocalMessage getMessage();
}

View file

@ -248,7 +248,6 @@ public class MigrationTest {
LocalBodyPart attachmentPart = (LocalBodyPart) body.getBodyPart(1);
Assert.assertEquals("image/png", attachmentPart.getMimeType());
Assert.assertEquals("2", attachmentPart.getServerExtra());
Assert.assertEquals("k9small.png", attachmentPart.getDisplayName());
Assert.assertEquals("attachment", MimeUtility.getHeaderParameter(attachmentPart.getDisposition(), null));
Assert.assertEquals("k9small.png", MimeUtility.getHeaderParameter(attachmentPart.getDisposition(), "filename"));
Assert.assertEquals("2250", MimeUtility.getHeaderParameter(attachmentPart.getDisposition(), "size"));

View file

@ -31,7 +31,6 @@ public class AttachmentInfoExtractorTest {
public static final long TEST_SIZE = 123L;
public static final String TEST_ACCOUNT_UUID = "uuid";
public static final long TEST_ID = 234L;
public static final String TEST_DISPLAY_NAME = "test-display-name";
public static final String[] TEST_CONTENT_ID = new String[] { "test-content-id" };
@ -57,14 +56,11 @@ public class AttachmentInfoExtractorTest {
when(part.getMimeType()).thenReturn(TEST_MIME_TYPE);
when(part.getSize()).thenReturn(TEST_SIZE);
when(part.getAccountUuid()).thenReturn(TEST_ACCOUNT_UUID);
when(part.getDisplayName()).thenReturn(TEST_DISPLAY_NAME);
AttachmentViewInfo attachmentViewInfo = attachmentInfoExtractor.extractAttachmentInfo(part);
assertEquals(AttachmentProvider.getAttachmentUri(TEST_ACCOUNT_UUID, TEST_ID), attachmentViewInfo.uri);
assertEquals(true, attachmentViewInfo.firstClassAttachment);
assertEquals(TEST_SIZE, attachmentViewInfo.size);
assertEquals(TEST_DISPLAY_NAME, attachmentViewInfo.displayName);
assertEquals(TEST_MIME_TYPE, attachmentViewInfo.mimeType);
}