mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-22 23:59:54 +01:00
Assert that we have a local update
This commit is contained in:
@@ -57,7 +57,6 @@ public interface MailboxPropertyManager {
|
|||||||
*/
|
*/
|
||||||
String MSG_KEY_LOCAL = "local";
|
String MSG_KEY_LOCAL = "local";
|
||||||
|
|
||||||
@Nullable
|
|
||||||
MailboxPropertiesUpdate getLocalProperties(Transaction txn, ContactId c)
|
MailboxPropertiesUpdate getLocalProperties(Transaction txn, ContactId c)
|
||||||
throws DbException;
|
throws DbException;
|
||||||
|
|
||||||
|
|||||||
@@ -180,10 +180,15 @@ class MailboxPropertyManagerImpl implements MailboxPropertyManager,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
|
||||||
public MailboxPropertiesUpdate getLocalProperties(Transaction txn,
|
public MailboxPropertiesUpdate getLocalProperties(Transaction txn,
|
||||||
ContactId c) throws DbException {
|
ContactId c) throws DbException {
|
||||||
return getProperties(txn, db.getContact(txn, c), true);
|
MailboxPropertiesUpdate local =
|
||||||
|
getProperties(txn, db.getContact(txn, c), true);
|
||||||
|
// An update (with or without mailbox) is created when contact is added
|
||||||
|
if (local == null) {
|
||||||
|
throw new DbException();
|
||||||
|
}
|
||||||
|
return local;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -673,30 +673,6 @@ public class MailboxPropertyManagerImplTest extends BrambleMockTestCase {
|
|||||||
assertTrue(mailboxPropertiesUpdateEqual(local, updateMailbox));
|
assertTrue(mailboxPropertiesUpdateEqual(local, updateMailbox));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetLocalPropertiesReturnsNullBecauseNoUpdate()
|
|
||||||
throws Exception {
|
|
||||||
Transaction txn = new Transaction(null, false);
|
|
||||||
Contact contact = getContact();
|
|
||||||
Group contactGroup = getGroup(CLIENT_ID, MAJOR_VERSION);
|
|
||||||
Map<MessageId, BdfDictionary> emptyMessageMetadata =
|
|
||||||
new LinkedHashMap<>();
|
|
||||||
|
|
||||||
context.checking(new Expectations() {{
|
|
||||||
oneOf(db).getContact(txn, contact.getId());
|
|
||||||
will(returnValue(contact));
|
|
||||||
oneOf(contactGroupFactory).createContactGroup(CLIENT_ID,
|
|
||||||
MAJOR_VERSION, contact);
|
|
||||||
will(returnValue(contactGroup));
|
|
||||||
oneOf(clientHelper).getMessageMetadataAsDictionary(txn,
|
|
||||||
contactGroup.getId());
|
|
||||||
will(returnValue(emptyMessageMetadata));
|
|
||||||
}});
|
|
||||||
|
|
||||||
MailboxPropertyManagerImpl t = createInstance();
|
|
||||||
assertNull(t.getLocalProperties(txn, contact.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetLocalPropertiesNoMailbox()
|
public void testGetLocalPropertiesNoMailbox()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user