コード例 #1
0
 /**
  * Preparations for the test
  *
  * @throws Exception in case the setup failed
  */
 @BeforeClass
 public void classInitialze() throws Exception {
   // check for test blogs, if not existing create them
   BlogManagement bm = ServiceLocator.findService(BlogManagement.class);
   Blog testBlog = bm.findBlogByIdentifier(BlogManagementTest.TEST_BLOG_IDENTIFIER);
   if (testBlog == null) {
     bm.createBlog(new BlogManagementTest().generateBlogTO());
   }
 }
コード例 #2
0
 /** Cleanup method. */
 @AfterClass
 protected void cleanUp() {
   BlogManagement bm = ServiceLocator.findService(BlogManagement.class);
   // remove the created test blogs
   try {
     Blog testBlog = bm.findBlogByIdentifier(BlogManagementTest.TEST_BLOG_IDENTIFIER);
     if (testBlog != null) {
       bm.deleteBlog(testBlog.getId(), null);
     }
   } catch (Exception e) {
     LOG.error("Clean up after test failed. ", e);
   }
 }