Advertisement
Guest User

Untitled

a guest
Aug 24th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. @Test
  2. public void testCheckIfCategoryAlreadyExistsHelperMethodShouldReturnTrue() throws WrapperApplicationException{
  3. List<Category> categoryList = Arrays.asList(
  4. new Category(CATEGORY_NAME, Category.CategoryStatus.ACCEPTED),
  5. new Category("Name 2", Category.CategoryStatus.ACCEPTED),
  6. new Category("Name 3", Category.CategoryStatus.ACCEPTED));
  7.  
  8. when(categoryDAO.findAll()).thenReturn(categoryList);
  9. boolean alreadyExists = categoryService.checkIfCategoryAlreadyExistsHelperMethod(CATEGORY_NAME);
  10. assertEquals(true, alreadyExists);
  11. }
  12.  
  13. @Test
  14. public void testCheckIfCategoryAlreadyExistsHelperMethodShouldReturnFalse() throws WrapperApplicationException{
  15. List<Category> categoryList = Arrays.asList(
  16. new Category(CATEGORY_NAME, Category.CategoryStatus.ACCEPTED),
  17. new Category("Name 2", Category.CategoryStatus.ACCEPTED),
  18. new Category("Name 3", Category.CategoryStatus.ACCEPTED));
  19.  
  20. when(categoryDAO.findAll()).thenReturn(categoryList);
  21. boolean alreadyExists = categoryService.checkIfCategoryAlreadyExistsHelperMethod("Completely another name");
  22. assertEquals(false, alreadyExists);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement