mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
More static imports.
This commit is contained in:
@@ -38,7 +38,6 @@ import java.security.GeneralSecurityException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -50,6 +49,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.NONE;
|
||||
import static org.briarproject.briar.api.blog.BlogConstants.KEY_AUTHOR;
|
||||
import static org.briarproject.briar.api.blog.BlogConstants.KEY_COMMENT;
|
||||
@@ -560,8 +560,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
||||
private BlogPostHeader getPostHeaderFromMetadata(Transaction txn,
|
||||
GroupId groupId, MessageId id, BdfDictionary meta)
|
||||
throws DbException, FormatException {
|
||||
return getPostHeaderFromMetadata(txn, groupId, id, meta,
|
||||
Collections.emptyMap());
|
||||
return getPostHeaderFromMetadata(txn, groupId, id, meta, emptyMap());
|
||||
}
|
||||
|
||||
private BlogPostHeader getPostHeaderFromMetadata(Transaction txn,
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.briarproject.briar.api.client.MessageTree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -14,6 +13,9 @@ import java.util.Map;
|
||||
|
||||
import javax.annotation.concurrent.ThreadSafe;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static java.util.Collections.sort;
|
||||
|
||||
@ThreadSafe
|
||||
@NotNullByDefault
|
||||
public class MessageTreeImpl<T extends MessageTree.MessageNode>
|
||||
@@ -47,7 +49,7 @@ public class MessageTreeImpl<T extends MessageTree.MessageNode>
|
||||
|
||||
@Override
|
||||
public synchronized void add(T node) {
|
||||
add(Collections.singletonList(node));
|
||||
add(singletonList(node));
|
||||
}
|
||||
|
||||
private void markAsUnsorted(List<T> list) {
|
||||
@@ -69,7 +71,7 @@ public class MessageTreeImpl<T extends MessageTree.MessageNode>
|
||||
|
||||
private void sortUnsorted() {
|
||||
for (List<T> list : unsortedLists) {
|
||||
Collections.sort(list, comparator);
|
||||
sort(list, comparator);
|
||||
}
|
||||
unsortedLists.clear();
|
||||
}
|
||||
@@ -87,9 +89,9 @@ public class MessageTreeImpl<T extends MessageTree.MessageNode>
|
||||
public synchronized void setComparator(Comparator<T> comparator) {
|
||||
this.comparator = comparator;
|
||||
// Sort all lists with the new comparator
|
||||
Collections.sort(roots, comparator);
|
||||
sort(roots, comparator);
|
||||
for (Map.Entry<MessageId, List<T>> entry : nodeMap.entrySet()) {
|
||||
Collections.sort(entry.getValue(), comparator);
|
||||
sort(entry.getValue(), comparator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,14 @@ package org.briarproject.briar.feed;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import okhttp3.Dns;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
|
||||
class NoDns implements Dns {
|
||||
|
||||
private static final byte[] UNSPECIFIED_ADDRESS = new byte[4];
|
||||
@@ -22,7 +23,7 @@ class NoDns implements Dns {
|
||||
throws UnknownHostException {
|
||||
InetAddress unspecified =
|
||||
InetAddress.getByAddress(hostname, UNSPECIFIED_ADDRESS);
|
||||
return Collections.singletonList(unspecified);
|
||||
return singletonList(unspecified);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.briarproject.briar.api.forum.event.ForumPostReceivedEvent;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -45,6 +44,7 @@ import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.ThreadSafe;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.OURSELVES;
|
||||
import static org.briarproject.briar.api.forum.ForumConstants.KEY_AUTHOR;
|
||||
import static org.briarproject.briar.api.forum.ForumConstants.KEY_LOCAL;
|
||||
@@ -249,7 +249,7 @@ class ForumManagerImpl extends BdfIncomingMessageHook implements ForumManager {
|
||||
|
||||
private ForumPostHeader getForumPostHeader(Transaction txn, MessageId id,
|
||||
BdfDictionary meta) throws DbException, FormatException {
|
||||
return getForumPostHeader(txn, id, meta, Collections.emptyMap());
|
||||
return getForumPostHeader(txn, id, meta, emptyMap());
|
||||
}
|
||||
|
||||
private ForumPostHeader getForumPostHeader(Transaction txn, MessageId id,
|
||||
|
||||
@@ -15,10 +15,9 @@ import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.bramble.api.system.Clock;
|
||||
import org.briarproject.briar.api.client.SessionId;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.briarproject.bramble.api.crypto.CryptoConstants.MAC_BYTES;
|
||||
import static org.briarproject.bramble.api.crypto.CryptoConstants.MAX_SIGNATURE_BYTES;
|
||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
|
||||
@@ -84,8 +83,7 @@ class IntroductionValidator extends BdfMessageValidator {
|
||||
return new BdfMessageContext(meta);
|
||||
} else {
|
||||
MessageId dependency = new MessageId(previousMessageId);
|
||||
return new BdfMessageContext(meta,
|
||||
Collections.singletonList(dependency));
|
||||
return new BdfMessageContext(meta, singletonList(dependency));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,8 +116,7 @@ class IntroductionValidator extends BdfMessageValidator {
|
||||
return new BdfMessageContext(meta);
|
||||
} else {
|
||||
MessageId dependency = new MessageId(previousMessageId);
|
||||
return new BdfMessageContext(meta,
|
||||
Collections.singletonList(dependency));
|
||||
return new BdfMessageContext(meta, singletonList(dependency));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,8 +141,7 @@ class IntroductionValidator extends BdfMessageValidator {
|
||||
.encodeMetadata(AUTH, sessionId, m.getTimestamp(), false, false,
|
||||
false);
|
||||
MessageId dependency = new MessageId(previousMessageId);
|
||||
return new BdfMessageContext(meta,
|
||||
Collections.singletonList(dependency));
|
||||
return new BdfMessageContext(meta, singletonList(dependency));
|
||||
}
|
||||
|
||||
private BdfMessageContext validateActivateMessage(Message m, BdfList body)
|
||||
@@ -169,8 +165,7 @@ class IntroductionValidator extends BdfMessageValidator {
|
||||
return new BdfMessageContext(meta);
|
||||
} else {
|
||||
MessageId dependency = new MessageId(previousMessageId);
|
||||
return new BdfMessageContext(meta,
|
||||
Collections.singletonList(dependency));
|
||||
return new BdfMessageContext(meta, singletonList(dependency));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,8 +187,7 @@ class IntroductionValidator extends BdfMessageValidator {
|
||||
return new BdfMessageContext(meta);
|
||||
} else {
|
||||
MessageId dependency = new MessageId(previousMessageId);
|
||||
return new BdfMessageContext(meta,
|
||||
Collections.singletonList(dependency));
|
||||
return new BdfMessageContext(meta, singletonList(dependency));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ import org.briarproject.briar.api.privategroup.event.GroupMessageAddedEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -54,6 +53,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import javax.annotation.concurrent.ThreadSafe;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.OURSELVES;
|
||||
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.UNVERIFIED;
|
||||
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.VERIFIED;
|
||||
@@ -574,7 +574,7 @@ class PrivateGroupManagerImpl extends BdfIncomingMessageHook
|
||||
BdfDictionary meta, boolean local)
|
||||
throws DbException, FormatException {
|
||||
GroupMessageHeader header = getGroupMessageHeader(txn, m.getGroupId(),
|
||||
m.getId(), meta, Collections.emptyMap());
|
||||
m.getId(), meta, emptyMap());
|
||||
String text = getMessageText(clientHelper.toList(m));
|
||||
txn.attach(new GroupMessageAddedEvent(m.getGroupId(), header, text,
|
||||
local));
|
||||
@@ -584,7 +584,7 @@ class PrivateGroupManagerImpl extends BdfIncomingMessageHook
|
||||
BdfDictionary meta, boolean local, Visibility v)
|
||||
throws DbException, FormatException {
|
||||
JoinMessageHeader header = getJoinMessageHeader(txn, m.getGroupId(),
|
||||
m.getId(), meta, Collections.emptyMap(), v);
|
||||
m.getId(), meta, emptyMap(), v);
|
||||
txn.attach(new GroupMessageAddedEvent(m.getGroupId(), header, "",
|
||||
local));
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ import org.briarproject.briar.api.privategroup.PrivateGroup;
|
||||
import org.briarproject.briar.api.privategroup.PrivateGroupFactory;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_SIGNATURE_LENGTH;
|
||||
import static org.briarproject.bramble.util.ValidationUtils.checkLength;
|
||||
import static org.briarproject.bramble.util.ValidationUtils.checkSize;
|
||||
@@ -120,8 +120,7 @@ class GroupInvitationValidator extends BdfMessageValidator {
|
||||
return new BdfMessageContext(meta);
|
||||
} else {
|
||||
MessageId dependency = new MessageId(previousMessageId);
|
||||
return new BdfMessageContext(meta,
|
||||
Collections.singletonList(dependency));
|
||||
return new BdfMessageContext(meta, singletonList(dependency));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,8 +138,7 @@ class GroupInvitationValidator extends BdfMessageValidator {
|
||||
return new BdfMessageContext(meta);
|
||||
} else {
|
||||
MessageId dependency = new MessageId(previousMessageId);
|
||||
return new BdfMessageContext(meta,
|
||||
Collections.singletonList(dependency));
|
||||
return new BdfMessageContext(meta, singletonList(dependency));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,9 @@ import org.briarproject.bramble.api.sync.Message;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.bramble.api.system.Clock;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.briarproject.bramble.util.ValidationUtils.checkLength;
|
||||
import static org.briarproject.bramble.util.ValidationUtils.checkSize;
|
||||
import static org.briarproject.briar.api.sharing.SharingConstants.MAX_INVITATION_TEXT_LENGTH;
|
||||
@@ -70,8 +69,7 @@ abstract class SharingValidator extends BdfMessageValidator {
|
||||
return new BdfMessageContext(meta);
|
||||
} else {
|
||||
MessageId dependency = new MessageId(previousMessageId);
|
||||
return new BdfMessageContext(meta,
|
||||
Collections.singletonList(dependency));
|
||||
return new BdfMessageContext(meta, singletonList(dependency));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,8 +91,7 @@ abstract class SharingValidator extends BdfMessageValidator {
|
||||
return new BdfMessageContext(meta);
|
||||
} else {
|
||||
MessageId dependency = new MessageId(previousMessageId);
|
||||
return new BdfMessageContext(meta,
|
||||
Collections.singletonList(dependency));
|
||||
return new BdfMessageContext(meta, singletonList(dependency));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.client.MessageTree;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Arrays.copyOf;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.briarproject.bramble.test.TestUtils.getRandomId;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@@ -48,8 +48,8 @@ public class MessageTreeImplTest {
|
||||
nodes[3].setTimestamp(timestamp - 2);
|
||||
nodes[2].setTimestamp(timestamp - 1);
|
||||
// add all nodes except the last one
|
||||
tree.add(Arrays.asList(Arrays.copyOf(nodes, nodes.length - 1)));
|
||||
tree.add(Collections.singletonList(nodes[nodes.length - 1]));
|
||||
tree.add(asList(copyOf(nodes, nodes.length - 1)));
|
||||
tree.add(singletonList(nodes[nodes.length - 1]));
|
||||
TestNode[] sortedNodes =
|
||||
tree.depthFirstOrder().toArray(new TestNode[5]);
|
||||
assertEquals(nodes[4], sortedNodes[0]);
|
||||
|
||||
@@ -16,10 +16,11 @@ import org.jmock.Expectations;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_SIGNATURE_LENGTH;
|
||||
import static org.briarproject.bramble.test.TestUtils.getAuthor;
|
||||
import static org.briarproject.bramble.test.TestUtils.getRandomBytes;
|
||||
@@ -178,7 +179,7 @@ public class GroupMessageValidatorTest extends ValidatorTestCase {
|
||||
BdfMessageContext messageContext =
|
||||
validator.validateMessage(message, group, body);
|
||||
assertExpectedMessageContext(messageContext, JOIN, creatorList,
|
||||
Collections.emptyList());
|
||||
emptyList());
|
||||
assertTrue(messageContext.getDictionary()
|
||||
.getBoolean(KEY_INITIAL_JOIN_MSG));
|
||||
}
|
||||
@@ -363,7 +364,7 @@ public class GroupMessageValidatorTest extends ValidatorTestCase {
|
||||
BdfMessageContext messageContext =
|
||||
validator.validateMessage(message, group, body);
|
||||
assertExpectedMessageContext(messageContext, JOIN, memberList,
|
||||
Collections.emptyList());
|
||||
emptyList());
|
||||
assertFalse(messageContext.getDictionary()
|
||||
.getBoolean(KEY_INITIAL_JOIN_MSG));
|
||||
}
|
||||
@@ -606,7 +607,7 @@ public class GroupMessageValidatorTest extends ValidatorTestCase {
|
||||
BdfMessageContext messageContext =
|
||||
validator.validateMessage(message, group, body);
|
||||
assertExpectedMessageContext(messageContext, POST, memberList,
|
||||
Arrays.asList(parentId, previousMsgId));
|
||||
asList(parentId, previousMsgId));
|
||||
assertArrayEquals(previousMsgId.getBytes(),
|
||||
messageContext.getDictionary().getRaw(KEY_PREVIOUS_MSG_ID));
|
||||
assertArrayEquals(parentId.getBytes(),
|
||||
@@ -621,7 +622,7 @@ public class GroupMessageValidatorTest extends ValidatorTestCase {
|
||||
BdfMessageContext messageContext =
|
||||
validator.validateMessage(message, group, body);
|
||||
assertExpectedMessageContext(messageContext, POST, memberList,
|
||||
Collections.singletonList(previousMsgId));
|
||||
singletonList(previousMsgId));
|
||||
assertArrayEquals(previousMsgId.getBytes(),
|
||||
messageContext.getDictionary().getRaw(KEY_PREVIOUS_MSG_ID));
|
||||
assertFalse(
|
||||
|
||||
@@ -35,14 +35,16 @@ import org.jmock.Expectations;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static junit.framework.TestCase.fail;
|
||||
import static org.briarproject.bramble.api.sync.Group.Visibility.SHARED;
|
||||
import static org.briarproject.bramble.test.TestUtils.getAuthor;
|
||||
@@ -112,9 +114,8 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
private final BdfDictionary bdfSession =
|
||||
BdfDictionary.of(new BdfEntry("f", "o"));
|
||||
private final Map<MessageId, BdfDictionary> oneResult =
|
||||
Collections.singletonMap(storageMessage.getId(), bdfSession);
|
||||
private final Map<MessageId, BdfDictionary> noResults =
|
||||
Collections.emptyMap();
|
||||
singletonMap(storageMessage.getId(), bdfSession);
|
||||
private final Map<MessageId, BdfDictionary> noResults = emptyMap();
|
||||
|
||||
|
||||
public GroupInvitationManagerImplTest() {
|
||||
@@ -156,7 +157,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
will(returnValue(false));
|
||||
oneOf(db).addGroup(txn, localGroup);
|
||||
oneOf(db).getContacts(txn);
|
||||
will(returnValue(Collections.singletonList(contact)));
|
||||
will(returnValue(singletonList(contact)));
|
||||
}});
|
||||
expectAddingContact(contact);
|
||||
groupInvitationManager.createLocalState(txn);
|
||||
@@ -192,7 +193,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
.mergeGroupMetadata(txn, contactGroup.getId(), meta);
|
||||
oneOf(db).getGroups(txn, PrivateGroupManager.CLIENT_ID,
|
||||
PrivateGroupManager.MAJOR_VERSION);
|
||||
will(returnValue(Collections.singletonList(privateGroup)));
|
||||
will(returnValue(singletonList(privateGroup)));
|
||||
oneOf(privateGroupManager).isMember(txn, privateGroup.getId(),
|
||||
c.getAuthor());
|
||||
will(returnValue(true));
|
||||
@@ -743,7 +744,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
oneOf(db).startTransaction(true);
|
||||
will(returnValue(txn));
|
||||
oneOf(db).getContacts(txn);
|
||||
will(returnValue(Collections.singletonList(contact)));
|
||||
will(returnValue(singletonList(contact)));
|
||||
oneOf(contactGroupFactory).createContactGroup(CLIENT_ID,
|
||||
MAJOR_VERSION, contact);
|
||||
will(returnValue(contactGroup));
|
||||
@@ -836,7 +837,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
expectAddingMember(privateGroup.getId(), contact);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(db).getContactsByAuthorId(txn, author.getId());
|
||||
will(returnValue(Collections.singletonList(contact)));
|
||||
will(returnValue(singletonList(contact)));
|
||||
}});
|
||||
groupInvitationManager.addingMember(txn, privateGroup.getId(), author);
|
||||
}
|
||||
@@ -847,8 +848,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
author.getId(), getRandomString(5), true, true);
|
||||
Contact contact3 = new Contact(new ContactId(3), author,
|
||||
author.getId(), getRandomString(5), true, true);
|
||||
Collection<Contact> contacts =
|
||||
Arrays.asList(contact, contact2, contact3);
|
||||
Collection<Contact> contacts = asList(contact, contact2, contact3);
|
||||
|
||||
Group contactGroup2 = getGroup(CLIENT_ID, MAJOR_VERSION);
|
||||
Group contactGroup3 = getGroup(CLIENT_ID, MAJOR_VERSION);
|
||||
@@ -861,9 +861,9 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
BdfDictionary.of(new BdfEntry("f3", "o"));
|
||||
|
||||
expectGetSession(oneResult, sessionId, contactGroup.getId());
|
||||
expectGetSession(Collections.singletonMap(storageId2, bdfSession2),
|
||||
expectGetSession(singletonMap(storageId2, bdfSession2),
|
||||
sessionId, contactGroup2.getId());
|
||||
expectGetSession(Collections.singletonMap(storageId3, bdfSession3),
|
||||
expectGetSession(singletonMap(storageId3, bdfSession3),
|
||||
sessionId, contactGroup3.getId());
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
|
||||
@@ -11,9 +11,9 @@ import org.briarproject.briar.api.privategroup.GroupMessage;
|
||||
import org.jmock.Expectations;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static org.briarproject.bramble.api.sync.Group.Visibility.INVISIBLE;
|
||||
import static org.briarproject.bramble.api.sync.Group.Visibility.SHARED;
|
||||
import static org.briarproject.bramble.api.sync.Group.Visibility.VISIBLE;
|
||||
@@ -753,7 +753,7 @@ public class InviteeProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
BdfDictionary query = BdfDictionary.of(new BdfEntry("query", ""));
|
||||
BdfDictionary meta = BdfDictionary.of(new BdfEntry("meta", ""));
|
||||
Map<MessageId, BdfDictionary> invites =
|
||||
Collections.singletonMap(lastRemoteMessageId, meta);
|
||||
singletonMap(lastRemoteMessageId, meta);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(messageParser)
|
||||
.getInvitesAvailableToAnswerQuery(privateGroupId);
|
||||
|
||||
@@ -28,10 +28,11 @@ import org.jmock.Expectations;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.briarproject.bramble.api.sync.Group.Visibility.SHARED;
|
||||
import static org.briarproject.bramble.test.TestUtils.getAuthor;
|
||||
import static org.briarproject.bramble.test.TestUtils.getGroup;
|
||||
@@ -66,8 +67,7 @@ public class BlogSharingManagerImplTest extends BrambleMockTestCase {
|
||||
private final Contact contact =
|
||||
new Contact(contactId, author, localAuthor.getId(),
|
||||
getRandomString(5), true, true);
|
||||
private final Collection<Contact> contacts =
|
||||
Collections.singletonList(contact);
|
||||
private final Collection<Contact> contacts = singletonList(contact);
|
||||
private final Group localGroup = getGroup(CLIENT_ID, MAJOR_VERSION);
|
||||
private final Group contactGroup = getGroup(CLIENT_ID, MAJOR_VERSION);
|
||||
private final Group blogGroup =
|
||||
@@ -120,7 +120,7 @@ public class BlogSharingManagerImplTest extends BrambleMockTestCase {
|
||||
private void expectAddingContact(Transaction txn) throws Exception {
|
||||
BdfDictionary meta = BdfDictionary.of(
|
||||
new BdfEntry(GROUP_KEY_CONTACT_ID, contactId.getInt()));
|
||||
Map<MessageId, BdfDictionary> sessions = Collections.emptyMap();
|
||||
Map<MessageId, BdfDictionary> sessions = emptyMap();
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
// Create the contact group and share it with the contact
|
||||
|
||||
Reference in New Issue
Block a user