mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Replaced Collections.singletonList() with more concise Arrays.asList().
This commit is contained in:
@@ -117,8 +117,8 @@ public class ProtocolIntegrationTest extends BriarTestCase {
|
|||||||
message3 = messageFactory.createMessage(null, group1,
|
message3 = messageFactory.createMessage(null, group1,
|
||||||
groupKeyPair.getPrivate(), author, authorKeyPair.getPrivate(),
|
groupKeyPair.getPrivate(), author, authorKeyPair.getPrivate(),
|
||||||
subject, messageBody.getBytes("UTF-8"));
|
subject, messageBody.getBytes("UTF-8"));
|
||||||
messageIds = Arrays.asList(message.getId(),
|
messageIds = Arrays.asList(message.getId(), message1.getId(),
|
||||||
message1.getId(), message2.getId(), message3.getId());
|
message2.getId(), message3.getId());
|
||||||
// Create some transport properties
|
// Create some transport properties
|
||||||
transportId = new TransportId(TestUtils.getRandomId());
|
transportId = new TransportId(TestUtils.getRandomId());
|
||||||
transportProperties = new TransportProperties(Collections.singletonMap(
|
transportProperties = new TransportProperties(Collections.singletonMap(
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.sf.briar.db;
|
|||||||
import static net.sf.briar.db.DatabaseConstants.BYTES_PER_SWEEP;
|
import static net.sf.briar.db.DatabaseConstants.BYTES_PER_SWEEP;
|
||||||
import static net.sf.briar.db.DatabaseConstants.MIN_FREE_SPACE;
|
import static net.sf.briar.db.DatabaseConstants.MIN_FREE_SPACE;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import net.sf.briar.api.clock.SystemClock;
|
import net.sf.briar.api.clock.SystemClock;
|
||||||
@@ -79,7 +80,7 @@ public class DatabaseComponentImplTest extends DatabaseComponentTest {
|
|||||||
oneOf(database).startTransaction();
|
oneOf(database).startTransaction();
|
||||||
will(returnValue(txn));
|
will(returnValue(txn));
|
||||||
oneOf(database).getOldMessages(txn, BYTES_PER_SWEEP);
|
oneOf(database).getOldMessages(txn, BYTES_PER_SWEEP);
|
||||||
will(returnValue(Collections.singletonList(messageId)));
|
will(returnValue(Arrays.asList(messageId)));
|
||||||
oneOf(database).getSendability(txn, messageId);
|
oneOf(database).getSendability(txn, messageId);
|
||||||
will(returnValue(0));
|
will(returnValue(0));
|
||||||
oneOf(database).removeMessage(txn, messageId);
|
oneOf(database).removeMessage(txn, messageId);
|
||||||
@@ -109,7 +110,7 @@ public class DatabaseComponentImplTest extends DatabaseComponentTest {
|
|||||||
oneOf(database).startTransaction();
|
oneOf(database).startTransaction();
|
||||||
will(returnValue(txn));
|
will(returnValue(txn));
|
||||||
oneOf(database).getOldMessages(txn, BYTES_PER_SWEEP);
|
oneOf(database).getOldMessages(txn, BYTES_PER_SWEEP);
|
||||||
will(returnValue(Collections.singletonList(messageId)));
|
will(returnValue(Arrays.asList(messageId)));
|
||||||
oneOf(database).getSendability(txn, messageId);
|
oneOf(database).getSendability(txn, messageId);
|
||||||
will(returnValue(1));
|
will(returnValue(1));
|
||||||
oneOf(database).getGroupMessageParent(txn, messageId);
|
oneOf(database).getGroupMessageParent(txn, messageId);
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
oneOf(listener).eventOccurred(with(any(ContactAddedEvent.class)));
|
oneOf(listener).eventOccurred(with(any(ContactAddedEvent.class)));
|
||||||
// getContacts()
|
// getContacts()
|
||||||
oneOf(database).getContacts(txn);
|
oneOf(database).getContacts(txn);
|
||||||
will(returnValue(Collections.singletonList(contactId)));
|
will(returnValue(Arrays.asList(contactId)));
|
||||||
// getRemoteProperties(transportId)
|
// getRemoteProperties(transportId)
|
||||||
oneOf(database).getRemoteProperties(txn, transportId);
|
oneOf(database).getRemoteProperties(txn, transportId);
|
||||||
will(returnValue(Collections.emptyMap()));
|
will(returnValue(Collections.emptyMap()));
|
||||||
@@ -145,7 +145,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
will(returnValue(Collections.emptyList()));
|
will(returnValue(Collections.emptyList()));
|
||||||
// getSubscriptions()
|
// getSubscriptions()
|
||||||
oneOf(database).getSubscriptions(txn);
|
oneOf(database).getSubscriptions(txn);
|
||||||
will(returnValue(Collections.singletonList(groupId)));
|
will(returnValue(Arrays.asList(groupId)));
|
||||||
// unsubscribe(groupId)
|
// unsubscribe(groupId)
|
||||||
oneOf(database).containsSubscription(txn, groupId);
|
oneOf(database).containsSubscription(txn, groupId);
|
||||||
will(returnValue(true));
|
will(returnValue(true));
|
||||||
@@ -173,13 +173,13 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
db.setRating(authorId, GOOD); // First time - listeners called
|
db.setRating(authorId, GOOD); // First time - listeners called
|
||||||
db.setRating(authorId, GOOD); // Second time - not called
|
db.setRating(authorId, GOOD); // Second time - not called
|
||||||
assertEquals(contactId, db.addContact());
|
assertEquals(contactId, db.addContact());
|
||||||
assertEquals(Collections.singletonList(contactId), db.getContacts());
|
assertEquals(Arrays.asList(contactId), db.getContacts());
|
||||||
assertEquals(Collections.emptyMap(),
|
assertEquals(Collections.emptyMap(),
|
||||||
db.getRemoteProperties(transportId));
|
db.getRemoteProperties(transportId));
|
||||||
db.subscribe(group); // First time - listeners called
|
db.subscribe(group); // First time - listeners called
|
||||||
db.subscribe(group); // Second time - not called
|
db.subscribe(group); // Second time - not called
|
||||||
assertEquals(Collections.emptyList(), db.getMessageHeaders(groupId));
|
assertEquals(Collections.emptyList(), db.getMessageHeaders(groupId));
|
||||||
assertEquals(Collections.singletonList(groupId), db.getSubscriptions());
|
assertEquals(Arrays.asList(groupId), db.getSubscriptions());
|
||||||
db.unsubscribe(groupId); // Listeners called
|
db.unsubscribe(groupId); // Listeners called
|
||||||
db.removeContact(contactId); // Listeners called
|
db.removeContact(contactId); // Listeners called
|
||||||
db.removeListener(listener);
|
db.removeListener(listener);
|
||||||
@@ -203,7 +203,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
will(returnValue(UNRATED));
|
will(returnValue(UNRATED));
|
||||||
// The sendability of the author's messages should be incremented
|
// The sendability of the author's messages should be incremented
|
||||||
oneOf(database).getMessagesByAuthor(txn, authorId);
|
oneOf(database).getMessagesByAuthor(txn, authorId);
|
||||||
will(returnValue(Collections.singletonList(messageId)));
|
will(returnValue(Arrays.asList(messageId)));
|
||||||
oneOf(database).getSendability(txn, messageId);
|
oneOf(database).getSendability(txn, messageId);
|
||||||
will(returnValue(0));
|
will(returnValue(0));
|
||||||
oneOf(database).setSendability(txn, messageId, 1);
|
oneOf(database).setSendability(txn, messageId, 1);
|
||||||
@@ -235,7 +235,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
will(returnValue(UNRATED));
|
will(returnValue(UNRATED));
|
||||||
// The sendability of the author's messages should be incremented
|
// The sendability of the author's messages should be incremented
|
||||||
oneOf(database).getMessagesByAuthor(txn, authorId);
|
oneOf(database).getMessagesByAuthor(txn, authorId);
|
||||||
will(returnValue(Collections.singletonList(messageId)));
|
will(returnValue(Arrays.asList(messageId)));
|
||||||
oneOf(database).getSendability(txn, messageId);
|
oneOf(database).getSendability(txn, messageId);
|
||||||
will(returnValue(0));
|
will(returnValue(0));
|
||||||
oneOf(database).setSendability(txn, messageId, 1);
|
oneOf(database).setSendability(txn, messageId, 1);
|
||||||
@@ -272,7 +272,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
will(returnValue(UNRATED));
|
will(returnValue(UNRATED));
|
||||||
// The sendability of the author's messages should be incremented
|
// The sendability of the author's messages should be incremented
|
||||||
oneOf(database).getMessagesByAuthor(txn, authorId);
|
oneOf(database).getMessagesByAuthor(txn, authorId);
|
||||||
will(returnValue(Collections.singletonList(messageId)));
|
will(returnValue(Arrays.asList(messageId)));
|
||||||
oneOf(database).getSendability(txn, messageId);
|
oneOf(database).getSendability(txn, messageId);
|
||||||
will(returnValue(0));
|
will(returnValue(0));
|
||||||
oneOf(database).setSendability(txn, messageId, 1);
|
oneOf(database).setSendability(txn, messageId, 1);
|
||||||
@@ -361,7 +361,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
oneOf(database).addGroupMessage(txn, message);
|
oneOf(database).addGroupMessage(txn, message);
|
||||||
will(returnValue(true));
|
will(returnValue(true));
|
||||||
oneOf(database).getContacts(txn);
|
oneOf(database).getContacts(txn);
|
||||||
will(returnValue(Collections.singletonList(contactId)));
|
will(returnValue(Arrays.asList(contactId)));
|
||||||
oneOf(database).addStatus(txn, contactId, messageId, false);
|
oneOf(database).addStatus(txn, contactId, messageId, false);
|
||||||
// The author is unrated and there are no sendable children
|
// The author is unrated and there are no sendable children
|
||||||
oneOf(database).getRating(txn, authorId);
|
oneOf(database).getRating(txn, authorId);
|
||||||
@@ -396,7 +396,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
oneOf(database).addGroupMessage(txn, message);
|
oneOf(database).addGroupMessage(txn, message);
|
||||||
will(returnValue(true));
|
will(returnValue(true));
|
||||||
oneOf(database).getContacts(txn);
|
oneOf(database).getContacts(txn);
|
||||||
will(returnValue(Collections.singletonList(contactId)));
|
will(returnValue(Arrays.asList(contactId)));
|
||||||
oneOf(database).addStatus(txn, contactId, messageId, false);
|
oneOf(database).addStatus(txn, contactId, messageId, false);
|
||||||
// The author is rated GOOD and there are two sendable children
|
// The author is rated GOOD and there are two sendable children
|
||||||
oneOf(database).getRating(txn, authorId);
|
oneOf(database).getRating(txn, authorId);
|
||||||
@@ -589,7 +589,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
} catch(NoSuchContactException expected) {}
|
} catch(NoSuchContactException expected) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
db.setSeen(contactId, Collections.singletonList(messageId));
|
db.setSeen(contactId, Arrays.asList(messageId));
|
||||||
fail();
|
fail();
|
||||||
} catch(NoSuchContactException expected) {}
|
} catch(NoSuchContactException expected) {}
|
||||||
|
|
||||||
@@ -896,12 +896,12 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
will(returnValue(true));
|
will(returnValue(true));
|
||||||
// Get the acked messages
|
// Get the acked messages
|
||||||
oneOf(database).removeOutstandingMessages(txn, contactId,
|
oneOf(database).removeOutstandingMessages(txn, contactId,
|
||||||
Collections.singletonList(messageId));
|
Arrays.asList(messageId));
|
||||||
}});
|
}});
|
||||||
DatabaseComponent db = createDatabaseComponent(database, cleaner,
|
DatabaseComponent db = createDatabaseComponent(database, cleaner,
|
||||||
shutdown);
|
shutdown);
|
||||||
|
|
||||||
db.receiveAck(contactId, new Ack(Collections.singletonList(messageId)));
|
db.receiveAck(contactId, new Ack(Arrays.asList(messageId)));
|
||||||
|
|
||||||
context.assertIsSatisfied();
|
context.assertIsSatisfied();
|
||||||
}
|
}
|
||||||
@@ -1046,7 +1046,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
oneOf(database).addStatus(txn, contactId, messageId, true);
|
oneOf(database).addStatus(txn, contactId, messageId, true);
|
||||||
// Set the status to seen = true for all other contacts (none)
|
// Set the status to seen = true for all other contacts (none)
|
||||||
oneOf(database).getContacts(txn);
|
oneOf(database).getContacts(txn);
|
||||||
will(returnValue(Collections.singletonList(contactId)));
|
will(returnValue(Arrays.asList(contactId)));
|
||||||
// Calculate the sendability - zero, so ancestors aren't updated
|
// Calculate the sendability - zero, so ancestors aren't updated
|
||||||
oneOf(database).getRating(txn, authorId);
|
oneOf(database).getRating(txn, authorId);
|
||||||
will(returnValue(UNRATED));
|
will(returnValue(UNRATED));
|
||||||
@@ -1088,7 +1088,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
oneOf(database).addStatus(txn, contactId, messageId, true);
|
oneOf(database).addStatus(txn, contactId, messageId, true);
|
||||||
// Set the status to seen = true for all other contacts (none)
|
// Set the status to seen = true for all other contacts (none)
|
||||||
oneOf(database).getContacts(txn);
|
oneOf(database).getContacts(txn);
|
||||||
will(returnValue(Collections.singletonList(contactId)));
|
will(returnValue(Arrays.asList(contactId)));
|
||||||
// Calculate the sendability - ancestors are updated
|
// Calculate the sendability - ancestors are updated
|
||||||
oneOf(database).getRating(txn, authorId);
|
oneOf(database).getRating(txn, authorId);
|
||||||
will(returnValue(GOOD));
|
will(returnValue(GOOD));
|
||||||
@@ -1213,7 +1213,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
oneOf(database).addGroupMessage(txn, message);
|
oneOf(database).addGroupMessage(txn, message);
|
||||||
will(returnValue(true));
|
will(returnValue(true));
|
||||||
oneOf(database).getContacts(txn);
|
oneOf(database).getContacts(txn);
|
||||||
will(returnValue(Collections.singletonList(contactId)));
|
will(returnValue(Arrays.asList(contactId)));
|
||||||
oneOf(database).addStatus(txn, contactId, messageId, false);
|
oneOf(database).addStatus(txn, contactId, messageId, false);
|
||||||
oneOf(database).getRating(txn, authorId);
|
oneOf(database).getRating(txn, authorId);
|
||||||
will(returnValue(UNRATED));
|
will(returnValue(UNRATED));
|
||||||
@@ -1391,13 +1391,13 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
allowing(database).commitTransaction(txn);
|
allowing(database).commitTransaction(txn);
|
||||||
allowing(database).containsContact(txn, contactId);
|
allowing(database).containsContact(txn, contactId);
|
||||||
will(returnValue(true));
|
will(returnValue(true));
|
||||||
// setSeen(contactId, Collections.singletonList(messageId))
|
// setSeen(contactId, Arrays.asList(messageId))
|
||||||
oneOf(database).setStatusSeenIfVisible(txn, contactId, messageId);
|
oneOf(database).setStatusSeenIfVisible(txn, contactId, messageId);
|
||||||
}});
|
}});
|
||||||
DatabaseComponent db = createDatabaseComponent(database, cleaner,
|
DatabaseComponent db = createDatabaseComponent(database, cleaner,
|
||||||
shutdown);
|
shutdown);
|
||||||
|
|
||||||
db.setSeen(contactId, Collections.singletonList(messageId));
|
db.setSeen(contactId, Arrays.asList(messageId));
|
||||||
|
|
||||||
context.assertIsSatisfied();
|
context.assertIsSatisfied();
|
||||||
}
|
}
|
||||||
@@ -1430,7 +1430,7 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
shutdown);
|
shutdown);
|
||||||
|
|
||||||
db.addListener(listener);
|
db.addListener(listener);
|
||||||
db.setVisibility(groupId, Collections.singletonList(contactId));
|
db.setVisibility(groupId, Arrays.asList(contactId));
|
||||||
|
|
||||||
context.assertIsSatisfied();
|
context.assertIsSatisfied();
|
||||||
}
|
}
|
||||||
@@ -1481,22 +1481,20 @@ public abstract class DatabaseComponentTest extends BriarTestCase {
|
|||||||
will(returnValue(true));
|
will(returnValue(true));
|
||||||
oneOf(database).containsTransport(txn, transportId);
|
oneOf(database).containsTransport(txn, transportId);
|
||||||
will(returnValue(true));
|
will(returnValue(true));
|
||||||
oneOf(database).addSecrets(txn,
|
oneOf(database).addSecrets(txn, Arrays.asList(temporarySecret));
|
||||||
Collections.singletonList(temporarySecret));
|
|
||||||
oneOf(database).commitTransaction(txn);
|
oneOf(database).commitTransaction(txn);
|
||||||
// getSecrets()
|
// getSecrets()
|
||||||
oneOf(database).startTransaction();
|
oneOf(database).startTransaction();
|
||||||
will(returnValue(txn));
|
will(returnValue(txn));
|
||||||
oneOf(database).getSecrets(txn);
|
oneOf(database).getSecrets(txn);
|
||||||
will(returnValue(Collections.singletonList(temporarySecret)));
|
will(returnValue(Arrays.asList(temporarySecret)));
|
||||||
oneOf(database).commitTransaction(txn);
|
oneOf(database).commitTransaction(txn);
|
||||||
}});
|
}});
|
||||||
DatabaseComponent db = createDatabaseComponent(database, cleaner,
|
DatabaseComponent db = createDatabaseComponent(database, cleaner,
|
||||||
shutdown);
|
shutdown);
|
||||||
|
|
||||||
db.addSecrets(Collections.singletonList(temporarySecret));
|
db.addSecrets(Arrays.asList(temporarySecret));
|
||||||
assertEquals(Collections.singletonList(temporarySecret),
|
assertEquals(Arrays.asList(temporarySecret), db.getSecrets());
|
||||||
db.getSecrets());
|
|
||||||
|
|
||||||
context.assertIsSatisfied();
|
context.assertIsSatisfied();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -490,11 +490,10 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
|
|
||||||
// The message ID should only be returned once
|
// The message ID should only be returned once
|
||||||
Collection<MessageId> ids = db.getMessagesToAck(txn, contactId, 1234);
|
Collection<MessageId> ids = db.getMessagesToAck(txn, contactId, 1234);
|
||||||
assertEquals(Collections.singletonList(messageId), ids);
|
assertEquals(Arrays.asList(messageId), ids);
|
||||||
|
|
||||||
// Remove the message ID
|
// Remove the message ID
|
||||||
db.removeMessagesToAck(txn, contactId,
|
db.removeMessagesToAck(txn, contactId, Arrays.asList(messageId));
|
||||||
Collections.singletonList(messageId));
|
|
||||||
|
|
||||||
// The message ID should have been removed
|
// The message ID should have been removed
|
||||||
assertEquals(Collections.emptyList(), db.getMessagesToAck(txn,
|
assertEquals(Collections.emptyList(), db.getMessagesToAck(txn,
|
||||||
@@ -532,8 +531,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
assertFalse(it.hasNext());
|
assertFalse(it.hasNext());
|
||||||
|
|
||||||
// Pretend that the message was acked
|
// Pretend that the message was acked
|
||||||
db.removeOutstandingMessages(txn, contactId,
|
db.removeOutstandingMessages(txn, contactId, Arrays.asList(messageId));
|
||||||
Collections.singletonList(messageId));
|
|
||||||
|
|
||||||
// The message still should not be sendable
|
// The message still should not be sendable
|
||||||
it = db.getSendableMessages(txn, contactId, ONE_MEGABYTE).iterator();
|
it = db.getSendableMessages(txn, contactId, ONE_MEGABYTE).iterator();
|
||||||
@@ -1108,8 +1106,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
assertEquals(Collections.emptyList(), db.getVisibility(txn, groupId));
|
assertEquals(Collections.emptyList(), db.getVisibility(txn, groupId));
|
||||||
// Make the group visible to the contact
|
// Make the group visible to the contact
|
||||||
db.addVisibility(txn, contactId, groupId);
|
db.addVisibility(txn, contactId, groupId);
|
||||||
assertEquals(Collections.singletonList(contactId),
|
assertEquals(Arrays.asList(contactId), db.getVisibility(txn, groupId));
|
||||||
db.getVisibility(txn, groupId));
|
|
||||||
// Make the group invisible again
|
// Make the group invisible again
|
||||||
db.removeVisibility(txn, contactId, groupId);
|
db.removeVisibility(txn, contactId, groupId);
|
||||||
assertEquals(Collections.emptyList(), db.getVisibility(txn, groupId));
|
assertEquals(Collections.emptyList(), db.getVisibility(txn, groupId));
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import static net.sf.briar.api.transport.TransportConstants.TAG_LENGTH;
|
|||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
@@ -29,8 +28,6 @@ import net.sf.briar.clock.ClockModule;
|
|||||||
import net.sf.briar.crypto.CryptoModule;
|
import net.sf.briar.crypto.CryptoModule;
|
||||||
import net.sf.briar.messaging.MessagingModule;
|
import net.sf.briar.messaging.MessagingModule;
|
||||||
import net.sf.briar.messaging.duplex.DuplexMessagingModule;
|
import net.sf.briar.messaging.duplex.DuplexMessagingModule;
|
||||||
import net.sf.briar.messaging.simplex.OutgoingSimplexConnection;
|
|
||||||
import net.sf.briar.messaging.simplex.SimplexMessagingModule;
|
|
||||||
import net.sf.briar.serial.SerialModule;
|
import net.sf.briar.serial.SerialModule;
|
||||||
import net.sf.briar.transport.TransportModule;
|
import net.sf.briar.transport.TransportModule;
|
||||||
|
|
||||||
@@ -186,7 +183,7 @@ public class OutgoingSimplexConnectionTest extends BriarTestCase {
|
|||||||
// One message to send
|
// One message to send
|
||||||
oneOf(db).generateBatch(with(contactId), with(any(int.class)),
|
oneOf(db).generateBatch(with(contactId), with(any(int.class)),
|
||||||
with(any(long.class)));
|
with(any(long.class)));
|
||||||
will(returnValue(Collections.singletonList(raw)));
|
will(returnValue(Arrays.asList(raw)));
|
||||||
// No more messages
|
// No more messages
|
||||||
oneOf(db).generateBatch(with(contactId), with(any(int.class)),
|
oneOf(db).generateBatch(with(contactId), with(any(int.class)),
|
||||||
with(any(long.class)));
|
with(any(long.class)));
|
||||||
|
|||||||
@@ -34,19 +34,19 @@ public class ConnectionRegistryImplTest extends BriarTestCase {
|
|||||||
c.getConnectedContacts(transportId1));
|
c.getConnectedContacts(transportId1));
|
||||||
// Check that a registered connection shows up
|
// Check that a registered connection shows up
|
||||||
c.registerConnection(contactId, transportId);
|
c.registerConnection(contactId, transportId);
|
||||||
assertEquals(Collections.singletonList(contactId),
|
assertEquals(Arrays.asList(contactId),
|
||||||
c.getConnectedContacts(transportId));
|
c.getConnectedContacts(transportId));
|
||||||
assertEquals(Collections.emptyList(),
|
assertEquals(Collections.emptyList(),
|
||||||
c.getConnectedContacts(transportId1));
|
c.getConnectedContacts(transportId1));
|
||||||
// Register an identical connection - lookup should be unaffected
|
// Register an identical connection - lookup should be unaffected
|
||||||
c.registerConnection(contactId, transportId);
|
c.registerConnection(contactId, transportId);
|
||||||
assertEquals(Collections.singletonList(contactId),
|
assertEquals(Arrays.asList(contactId),
|
||||||
c.getConnectedContacts(transportId));
|
c.getConnectedContacts(transportId));
|
||||||
assertEquals(Collections.emptyList(),
|
assertEquals(Collections.emptyList(),
|
||||||
c.getConnectedContacts(transportId1));
|
c.getConnectedContacts(transportId1));
|
||||||
// Unregister one of the connections - lookup should be unaffected
|
// Unregister one of the connections - lookup should be unaffected
|
||||||
c.unregisterConnection(contactId, transportId);
|
c.unregisterConnection(contactId, transportId);
|
||||||
assertEquals(Collections.singletonList(contactId),
|
assertEquals(Arrays.asList(contactId),
|
||||||
c.getConnectedContacts(transportId));
|
c.getConnectedContacts(transportId));
|
||||||
assertEquals(Collections.emptyList(),
|
assertEquals(Collections.emptyList(),
|
||||||
c.getConnectedContacts(transportId1));
|
c.getConnectedContacts(transportId1));
|
||||||
@@ -67,7 +67,7 @@ public class ConnectionRegistryImplTest extends BriarTestCase {
|
|||||||
c.registerConnection(contactId1, transportId1);
|
c.registerConnection(contactId1, transportId1);
|
||||||
assertEquals(Arrays.asList(contactId, contactId1),
|
assertEquals(Arrays.asList(contactId, contactId1),
|
||||||
c.getConnectedContacts(transportId));
|
c.getConnectedContacts(transportId));
|
||||||
assertEquals(Collections.singletonList(contactId1),
|
assertEquals(Arrays.asList(contactId1),
|
||||||
c.getConnectedContacts(transportId1));
|
c.getConnectedContacts(transportId1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user