Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void testCheckIfCategoryAlreadyExistsHelperMethodShouldReturnTrue() throws WrapperApplicationException{
- List<Category> categoryList = Arrays.asList(
- new Category(CATEGORY_NAME, Category.CategoryStatus.ACCEPTED),
- new Category("Name 2", Category.CategoryStatus.ACCEPTED),
- new Category("Name 3", Category.CategoryStatus.ACCEPTED));
- when(categoryDAO.findAll()).thenReturn(categoryList);
- boolean alreadyExists = categoryService.checkIfCategoryAlreadyExistsHelperMethod(CATEGORY_NAME);
- assertEquals(true, alreadyExists);
- }
- @Test
- public void testCheckIfCategoryAlreadyExistsHelperMethodShouldReturnFalse() throws WrapperApplicationException{
- List<Category> categoryList = Arrays.asList(
- new Category(CATEGORY_NAME, Category.CategoryStatus.ACCEPTED),
- new Category("Name 2", Category.CategoryStatus.ACCEPTED),
- new Category("Name 3", Category.CategoryStatus.ACCEPTED));
- when(categoryDAO.findAll()).thenReturn(categoryList);
- boolean alreadyExists = categoryService.checkIfCategoryAlreadyExistsHelperMethod("Completely another name");
- assertEquals(false, alreadyExists);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement