@Test public void askMoveDestinationDoesNotHaveRoleShouldIgnore() { when(roleManager.getCanMoveTopics()).thenReturn(false); controller.askMoveDestination("return path", 1, 2, 3); verify(mockResult).redirectTo("return path"); }
@Test public void askMoveDestination() { when(roleManager.getCanMoveTopics()).thenReturn(true); when(categoryRepository.getAllCategories()).thenReturn(new ArrayList<Category>()); controller.askMoveDestination("return path", 10, 1, 2, 3); assertArrayEquals(new int[] {1, 2, 3}, (int[]) mockResult.included("topicIds")); assertEquals(10, mockResult.included("fromForumId")); assertEquals("return path", mockResult.included("returnUrl")); assertEquals(new ArrayList<Category>(), mockResult.included("categories")); }