use of com.nixmash.blog.jpa.dto.PostDTO in project nixmash-blog by mintster.
the class PostServiceTests method updatedPostContainsNewlyAssignedCategory.
@Test
public void updatedPostContainsNewlyAssignedCategory() throws DuplicatePostNameException, PostNotFoundException {
Post post = postService.getPostById(1L);
assertEquals(post.getCategory().getCategoryValue(), "Uncategorized");
PostDTO postDTO = PostUtils.postToPostDTO(post);
postDTO.setCategoryId(2L);
post = postService.update(postDTO);
assertEquals(post.getCategory().getCategoryValue(), "Java");
}
use of com.nixmash.blog.jpa.dto.PostDTO in project nixmash-blog by mintster.
the class PostServiceTests method builderShouldReturnDomainAsPostSourceFromLink.
@Test
public void builderShouldReturnDomainAsPostSourceFromLink() {
PostDTO postDTO = PostDTO.getBuilder(USER_ID, POST_TITLE, POST_NAME, "http://wellformed.link", POST_CONTENT, POST_TYPE, DISPLAY_TYPE, CATEGORY_ID, TWITTER_CARD_SUMMARY).build();
assertEquals(postDTO.getPostSource(), "wellformed.link");
}
use of com.nixmash.blog.jpa.dto.PostDTO in project nixmash-blog by mintster.
the class PostServiceTests method builderShouldReturn_Null_ForMalformedLink.
@Test
public void builderShouldReturn_Null_ForMalformedLink() {
PostDTO postDTO = PostDTO.getBuilder(USER_ID, POST_TITLE, POST_NAME, "malformed.link", POST_CONTENT, POST_TYPE, DISPLAY_TYPE, CATEGORY_ID, TWITTER_CARD_SUMMARY).build();
assertEquals(postDTO.getPostSource(), null);
}
use of com.nixmash.blog.jpa.dto.PostDTO in project nixmash-blog by mintster.
the class JsoupPostMetaTests method updatePostMeta.
@Test
public void updatePostMeta() throws PostNotFoundException {
String NA = "na";
PostMeta postMeta = postService.getPostMetaById(1L);
assertEquals(postMeta.getTwitterDescription(), NA);
PostDTO postDTO = PostUtils.postToPostDTO(postService.getPostById(1L));
jsoupService.updatePostMeta(postDTO);
postMeta = postService.getPostMetaById(1L);
assertNotEquals(postMeta.getTwitterDescription(), NA);
}
Aggregations