Search in sources :

Example 6 with CategoryDTO

use of com.nixmash.blog.jpa.dto.CategoryDTO 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);
}
Also used : CategoryDTO(com.nixmash.blog.jpa.dto.CategoryDTO) Category(com.nixmash.blog.jpa.model.Category) Test(org.junit.Test)

Aggregations

CategoryDTO (com.nixmash.blog.jpa.dto.CategoryDTO)6 Category (com.nixmash.blog.jpa.model.Category)5 Test (org.junit.Test)4 Post (com.nixmash.blog.jpa.model.Post)1 PostUtils.postDtoToPost (com.nixmash.blog.jpa.utils.PostUtils.postDtoToPost)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1