use of com.nixmash.blog.jpa.model.Category in project nixmash-blog by mintster.
the class AdminPostsController method categoryList.
// endregion
// region Categories
@RequestMapping(value = "/categories", method = GET)
public ModelAndView categoryList(Model model) {
ModelAndView mav = new ModelAndView();
List<CategoryDTO> categories = postService.getAdminCategories();
mav.addObject("categories", categories);
mav.addObject("newCategory", new Category());
mav.setViewName(ADMIN_CATEGORIES_VIEW);
return mav;
}
use of com.nixmash.blog.jpa.model.Category in project nixmash-blog by mintster.
the class PostServiceTests method uncategorizedCategory.
@Test
public void uncategorizedCategory() throws CategoryNotFoundException {
Category category = postService.getCategory(UNCATEGORIZED);
assertEquals(category.getCategoryValue(), UNCATEGORIZED);
}
use of com.nixmash.blog.jpa.model.Category in project nixmash-blog by mintster.
the class PostServiceTests method newPostContainsAssignedCategory.
@Test
public void newPostContainsAssignedCategory() throws DuplicatePostNameException {
PostDTO postDTO = PostTestUtils.createPostDTO(100);
postDTO.setCategoryId(2L);
Post post = postService.add(postDTO);
assertNotNull(post);
assertNotNull(post.getCategory());
Category category = post.getCategory();
assertEquals(category.getCategoryValue(), "Java");
}
use of com.nixmash.blog.jpa.model.Category in project nixmash-blog by mintster.
the class PostServiceTests method setDefaultCategoryResultsInSingleDefault.
@Test
public void setDefaultCategoryResultsInSingleDefault() throws Exception {
// H2Data Status: Java Category is Sole Default
Category category = postService.getCategory("wannabe");
assertEquals(category.getIsDefault(), false);
assertEquals(defaultCategoryCount(), 1);
// Sole Default will be Wannabe Category
Category updated = postService.updateCategory(new CategoryDTO(5L, "Wannabe", 0, true, true));
assertEquals(category.getIsDefault(), true);
assertEquals(defaultCategoryCount(), 1);
}
Aggregations