use of com.nixmash.blog.jpa.model.Post in project nixmash-blog by mintster.
the class PostServiceTests method postDtoToPostShouldRetainPostSource.
@Test
public void postDtoToPostShouldRetainPostSource() {
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");
Post post = postDtoToPost(postDTO);
assertEquals(post.getPostSource(), "wellformed.link");
}
use of com.nixmash.blog.jpa.model.Post 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.model.Post in project nixmash-blog by mintster.
the class PostServiceTests method negativePostIdStub_NotYetSelected.
// endregion
// region Misc tests
@Test(expected = PostNotFoundException.class)
public void negativePostIdStub_NotYetSelected() throws PostNotFoundException {
Post post = postService.getPostById(-1L);
assertEquals(post.getPostName(), "not-yet-selected");
}
Aggregations