mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Added a method to get a list of available but not subscribed groups.
This commit is contained in:
@@ -1817,6 +1817,29 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
db.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAvailableGroups() throws Exception {
|
||||
Database<Connection> db = open(false);
|
||||
Connection txn = db.startTransaction();
|
||||
|
||||
// Add a contact who subscribes to a group
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId));
|
||||
db.setSubscriptions(txn, contactId, Arrays.asList(group), 1);
|
||||
|
||||
// The group should be available
|
||||
assertEquals(Collections.emptyList(), db.getSubscriptions(txn));
|
||||
assertEquals(Arrays.asList(group), db.getAvailableGroups(txn));
|
||||
|
||||
// Subscribe to the group - it should no longer be available
|
||||
db.addSubscription(txn, group);
|
||||
assertEquals(Arrays.asList(group), db.getSubscriptions(txn));
|
||||
assertEquals(Collections.emptyList(), db.getAvailableGroups(txn));
|
||||
|
||||
db.commitTransaction(txn);
|
||||
db.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExceptionHandling() throws Exception {
|
||||
Database<Connection> db = open(false);
|
||||
|
||||
Reference in New Issue
Block a user