@Test(expected = NoSuchContactException.class) public void testGetContactByUnknownAuthor() throws Exception { Transaction txn = new Transaction(null, true); context.checking(new Expectations() {{ oneOf(db).startTransaction(true); will(returnValue(txn)); oneOf(db).getContactsByAuthorId(txn, remote.getId()); will(returnValue(Collections.emptyList())); oneOf(db).endTransaction(txn); }}); contactManager.getContact(remote.getId(), local); }
@Override public Contact getContact(ContactId c) throws DbException { Contact contact; Transaction txn = db.startTransaction(true); try { contact = db.getContact(txn, c); db.commitTransaction(txn); } finally { db.endTransaction(txn); } return contact; }
ContactManagerImpl implements ContactManager { @Override public Contact getContact(ContactId c) throws DbException { Contact contact; Transaction txn = db.startTransaction(true); try { contact = db.getContact(txn, c); db.commitTransaction(txn); } finally { db.endTransaction(txn); } return contact; } }
ContactManagerImpl implements ContactManager { @Override public Contact getContact(ContactId c) throws DbException { Contact contact; Transaction txn = db.startTransaction(true); try { contact = db.getContact(txn, c); db.commitTransaction(txn); } finally { db.endTransaction(txn); } return contact; } @Inject  ContactManagerImpl(DatabaseComponent db, KeyManager keyManager); }
ContactManagerImpl implements ContactManager { @Override public Contact getContact(ContactId c) throws DbException { Contact contact; Transaction txn = db.startTransaction(true); try { contact = db.getContact(txn, c); db.commitTransaction(txn); } finally { db.endTransaction(txn); } return contact; } @Inject  ContactManagerImpl(DatabaseComponent db, KeyManager keyManager); @Override void registerContactHook(ContactHook hook); @Override ContactId addContact(Transaction txn, Author remote, AuthorId local,
			SecretKey master, long timestamp, boolean alice, boolean verified,
			boolean active); @Override ContactId addContact(Transaction txn, Author remote, AuthorId local,
			boolean verified, boolean active); @Override ContactId addContact(Author remote, AuthorId local, SecretKey master,
			long timestamp, boolean alice, boolean verified, boolean active); @Override Contact getContact(ContactId c); @Override Contact getContact(AuthorId remoteAuthorId, AuthorId localAuthorId); @Override Contact getContact(Transaction txn, AuthorId remoteAuthorId,
			AuthorId localAuthorId); @Override Collection<Contact> getActiveContacts(); @Override void removeContact(ContactId c); @Override void setContactActive(Transaction txn, ContactId c, boolean active); @Override boolean contactExists(Transaction txn, AuthorId remoteAuthorId,
			AuthorId localAuthorId); @Override boolean contactExists(AuthorId remoteAuthorId,
			AuthorId localAuthorId); @Override void removeContact(Transaction txn, ContactId c); }
ContactManagerImpl implements ContactManager { @Override public Contact getContact(ContactId c) throws DbException { Contact contact; Transaction txn = db.startTransaction(true); try { contact = db.getContact(txn, c); db.commitTransaction(txn); } finally { db.endTransaction(txn); } return contact; } @Inject  ContactManagerImpl(DatabaseComponent db, KeyManager keyManager); @Override void registerContactHook(ContactHook hook); @Override ContactId addContact(Transaction txn, Author remote, AuthorId local,
			SecretKey master, long timestamp, boolean alice, boolean verified,
			boolean active); @Override ContactId addContact(Transaction txn, Author remote, AuthorId local,
			boolean verified, boolean active); @Override ContactId addContact(Author remote, AuthorId local, SecretKey master,
			long timestamp, boolean alice, boolean verified, boolean active); @Override Contact getContact(ContactId c); @Override Contact getContact(AuthorId remoteAuthorId, AuthorId localAuthorId); @Override Contact getContact(Transaction txn, AuthorId remoteAuthorId,
			AuthorId localAuthorId); @Override Collection<Contact> getActiveContacts(); @Override void removeContact(ContactId c); @Override void setContactActive(Transaction txn, ContactId c, boolean active); @Override boolean contactExists(Transaction txn, AuthorId remoteAuthorId,
			AuthorId localAuthorId); @Override boolean contactExists(AuthorId remoteAuthorId,
			AuthorId localAuthorId); @Override void removeContact(Transaction txn, ContactId c);  }