Created
July 6, 2011 12:52
-
-
Save katta/1067151 to your computer and use it in GitHub Desktop.
CouchDB_Example_BlogPostIntegrationTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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