@Test public void testRemovingContactAfterRemovingBlog() throws DbException { Transaction txn = new Transaction(null, false); ContactId contactId = new ContactId(0); Contact contact = new Contact(contactId, blog2.getAuthor(), blog1.getAuthor().getId(), true, true); context.checking(new Expectations() {{ oneOf(blogFactory).createBlog(blog2.getAuthor()); will(returnValue(blog2)); oneOf(db).containsGroup(txn, blog2.getId()); will(returnValue(false)); }}); blogManager.removingContact(txn, contact); context.assertIsSatisfied(); }
@Override public void removingContact(Transaction txn, Contact c) throws DbException { Blog b = blogFactory.createBlog(c.getAuthor()); if (db.containsGroup(txn, b.getId())) removeBlog(txn, b); }
BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
		ContactHook, Client { @Override public void removingContact(Transaction txn, Contact c) throws DbException { Blog b = blogFactory.createBlog(c.getAuthor()); if (db.containsGroup(txn, b.getId())) removeBlog(txn, b); } }
BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
		ContactHook, Client { @Override public void removingContact(Transaction txn, Contact c) throws DbException { Blog b = blogFactory.createBlog(c.getAuthor()); if (db.containsGroup(txn, b.getId())) removeBlog(txn, b); } @Inject  BlogManagerImpl(DatabaseComponent db, IdentityManager identityManager,
			ClientHelper clientHelper, MetadataParser metadataParser,
			BlogFactory blogFactory, BlogPostFactory blogPostFactory); }
BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
		ContactHook, Client { @Override public void removingContact(Transaction txn, Contact c) throws DbException { Blog b = blogFactory.createBlog(c.getAuthor()); if (db.containsGroup(txn, b.getId())) removeBlog(txn, b); } @Inject  BlogManagerImpl(DatabaseComponent db, IdentityManager identityManager,
			ClientHelper clientHelper, MetadataParser metadataParser,
			BlogFactory blogFactory, BlogPostFactory blogPostFactory); @Override void createLocalState(Transaction txn); @Override void addingContact(Transaction txn, Contact c); @Override void removingContact(Transaction txn, Contact c); @Override void addBlog(Blog b); @Override void addBlog(Transaction txn, Blog b); @Override boolean canBeRemoved(Blog b); @Override void removeBlog(Blog b); @Override void removeBlog(Transaction txn, Blog b); @Override void addLocalPost(BlogPost p); @Override void addLocalPost(Transaction txn, BlogPost p); @Override void addLocalComment(LocalAuthor author, GroupId groupId,
			@Nullable String comment, BlogPostHeader parentHeader); @Override Blog getBlog(GroupId g); @Override Blog getBlog(Transaction txn, GroupId g); @Override Collection<Blog> getBlogs(LocalAuthor localAuthor); @Override Blog getPersonalBlog(Author author); @Override Collection<Blog> getBlogs(); @Override BlogPostHeader getPostHeader(GroupId g, MessageId m); @Override String getPostBody(MessageId m); @Override Collection<BlogPostHeader> getPostHeaders(GroupId g); @Override void setReadFlag(MessageId m, boolean read); @Override void registerRemoveBlogHook(RemoveBlogHook hook); }
BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
		ContactHook, Client { @Override public void removingContact(Transaction txn, Contact c) throws DbException { Blog b = blogFactory.createBlog(c.getAuthor()); if (db.containsGroup(txn, b.getId())) removeBlog(txn, b); } @Inject  BlogManagerImpl(DatabaseComponent db, IdentityManager identityManager,
			ClientHelper clientHelper, MetadataParser metadataParser,
			BlogFactory blogFactory, BlogPostFactory blogPostFactory); @Override void createLocalState(Transaction txn); @Override void addingContact(Transaction txn, Contact c); @Override void removingContact(Transaction txn, Contact c); @Override void addBlog(Blog b); @Override void addBlog(Transaction txn, Blog b); @Override boolean canBeRemoved(Blog b); @Override void removeBlog(Blog b); @Override void removeBlog(Transaction txn, Blog b); @Override void addLocalPost(BlogPost p); @Override void addLocalPost(Transaction txn, BlogPost p); @Override void addLocalComment(LocalAuthor author, GroupId groupId,
			@Nullable String comment, BlogPostHeader parentHeader); @Override Blog getBlog(GroupId g); @Override Blog getBlog(Transaction txn, GroupId g); @Override Collection<Blog> getBlogs(LocalAuthor localAuthor); @Override Blog getPersonalBlog(Author author); @Override Collection<Blog> getBlogs(); @Override BlogPostHeader getPostHeader(GroupId g, MessageId m); @Override String getPostBody(MessageId m); @Override Collection<BlogPostHeader> getPostHeaders(GroupId g); @Override void setReadFlag(MessageId m, boolean read); @Override void registerRemoveBlogHook(RemoveBlogHook hook);  }