@Test public void testGetAuthorStatus() throws DbException { Author author = getAuthor(); AuthorId authorId = author.getId(); Collection<Contact> contacts = new ArrayList<>(); context.checking(new Expectations() {{ oneOf(db).startTransaction(true); will(returnValue(txn)); oneOf(db).getLocalAuthors(txn); will(returnValue(localAuthors)); oneOf(db).getContactsByAuthorId(txn, authorId); will(returnValue(contacts)); oneOf(db).endTransaction(txn); }}); assertEquals(UNKNOWN, identityManager.getAuthorStatus(authorId)); Contact contact = new Contact(new ContactId(1), author, localAuthor.getId(), false, true); contacts.add(contact); checkAuthorStatusContext(authorId, contacts); assertEquals(UNVERIFIED, identityManager.getAuthorStatus(authorId)); Contact contact2 = new Contact(new ContactId(1), author, localAuthor.getId(), true, true); contacts.add(contact2); checkAuthorStatusContext(authorId, contacts); assertEquals(VERIFIED, identityManager.getAuthorStatus(authorId)); context.checking(new Expectations() {{ oneOf(db).startTransaction(true); will(returnValue(txn)); never(db).getLocalAuthors(txn); never(db).getContactsByAuthorId(txn, authorId); oneOf(db).endTransaction(txn); }}); assertEquals(OURSELVES, identityManager.getAuthorStatus(localAuthor.getId())); }
@Override public Status getAuthorStatus(AuthorId authorId) throws DbException { Transaction txn = db.startTransaction(true); try { return getAuthorStatus(txn, authorId); } finally { db.endTransaction(txn); } }
IdentityManagerImpl implements IdentityManager { @Override public Status getAuthorStatus(AuthorId authorId) throws DbException { Transaction txn = db.startTransaction(true); try { return getAuthorStatus(txn, authorId); } finally { db.endTransaction(txn); } } }
IdentityManagerImpl implements IdentityManager { @Override public Status getAuthorStatus(AuthorId authorId) throws DbException { Transaction txn = db.startTransaction(true); try { return getAuthorStatus(txn, authorId); } finally { db.endTransaction(txn); } } @Inject  IdentityManagerImpl(DatabaseComponent db, CryptoComponent crypto,
			AuthorFactory authorFactory); }
IdentityManagerImpl implements IdentityManager { @Override public Status getAuthorStatus(AuthorId authorId) throws DbException { Transaction txn = db.startTransaction(true); try { return getAuthorStatus(txn, authorId); } finally { db.endTransaction(txn); } } @Inject  IdentityManagerImpl(DatabaseComponent db, CryptoComponent crypto,
			AuthorFactory authorFactory); @Override LocalAuthor createLocalAuthor(String name); @Override void registerLocalAuthor(LocalAuthor a); @Override void storeLocalAuthor(); @Override LocalAuthor getLocalAuthor(); @Override LocalAuthor getLocalAuthor(Transaction txn); @Override Status getAuthorStatus(AuthorId authorId); @Override Status getAuthorStatus(Transaction txn, AuthorId authorId); }
IdentityManagerImpl implements IdentityManager { @Override public Status getAuthorStatus(AuthorId authorId) throws DbException { Transaction txn = db.startTransaction(true); try { return getAuthorStatus(txn, authorId); } finally { db.endTransaction(txn); } } @Inject  IdentityManagerImpl(DatabaseComponent db, CryptoComponent crypto,
			AuthorFactory authorFactory); @Override LocalAuthor createLocalAuthor(String name); @Override void registerLocalAuthor(LocalAuthor a); @Override void storeLocalAuthor(); @Override LocalAuthor getLocalAuthor(); @Override LocalAuthor getLocalAuthor(Transaction txn); @Override Status getAuthorStatus(AuthorId authorId); @Override Status getAuthorStatus(Transaction txn, AuthorId authorId);  }