Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save katta/1067151 to your computer and use it in GitHub Desktop.
Save katta/1067151 to your computer and use it in GitHub Desktop.
CouchDB_Example_BlogPostIntegrationTest
public class BlogPostIntegrationTest extends SpringIntegrationTest {
@Autowired
private BlogPosts blogPosts;
@Test
public void shouldPersistWithChildren() {
BlogPost blogPost = new BlogPost();
blogPost.setName("the blog");
blogPosts.add(blogPost);
Assert.assertNotNull(blogPost.getId());
Comment comment = new Comment();
comment.setNotes("this is a first comment");
blogPost.addComment(comment);
blogPosts.update(blogPost);
BlogPost persistedBlogPost = blogPosts.get(blogPost.getId());
Assert.assertEquals(1, persistedBlogPost.getComments().size());
Assert.assertEquals(comment.getNotes(),((Comment)CollectionUtils.get(persistedBlogPost.getComments(), 0)).getNotes());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment