Add AuthorManager#getMyAuthorInfo() without transaction

and add test for it
This commit is contained in:
Torsten Grote
2020-11-24 12:11:36 -03:00
parent 6939d8d230
commit 5aa041f9e1
3 changed files with 26 additions and 1 deletions

View File

@@ -106,7 +106,6 @@ public class AuthorManagerImplTest extends BrambleMockTestCase {
public void testGetAuthorInfoOurselves() throws DbException {
Transaction txn = new Transaction(null, true);
// check ourselves
context.checking(new Expectations() {{
oneOf(identityManager).getLocalAuthor(txn);
will(returnValue(localAuthor));
@@ -122,6 +121,22 @@ public class AuthorManagerImplTest extends BrambleMockTestCase {
assertEquals(avatarHeader, authorInfo.getAvatarHeader());
}
@Test
public void testGetMyAuthorInfo() throws DbException {
Transaction txn = new Transaction(null, true);
context.checking(new Expectations() {{
oneOf(avatarManager).getMyAvatarHeader(txn);
will(returnValue(avatarHeader));
}});
AuthorInfo authorInfo =
authorManager.getMyAuthorInfo(txn);
assertEquals(OURSELVES, authorInfo.getStatus());
assertNull(authorInfo.getAlias());
assertEquals(avatarHeader, authorInfo.getAvatarHeader());
}
private void checkAuthorInfoContext(Transaction txn, AuthorId authorId,
Collection<Contact> contacts) throws DbException {
context.checking(new Expectations() {{