@Test public void testGetTaskFulltext() throws Exception { String search = "Third Task"; List<Task> tasks = taskService.getTaskFulltext("\"" + search + "\""); for (Task task : tasks) { assertTrue( task.getName().contains(search) || task.getDescription().contains(search) || task.getTestSteps().contains(search)); } }
@Test public void testGetTasks() throws Exception { List<Task> tasks = taskService.getTasks(); for (Task task : tasks) { assertNotNull(task); assertTrue(task.getId() > 0); assertNotNull(task.getName()); assertNotNull(task.getDescription()); assertNotNull(task.getTestSteps()); assertNotNull(task.getCreator()); assertNotNull(task.getAssignee()); assertNotNull(task.getStatus()); assertNotNull(task.getPriority()); assertNotNull(task.getType()); } }
@Test public void testGetTaskByID() throws Exception { Optional<Task> optTask = taskService.getTaskByID(1); assertTrue(optTask.isPresent()); Task task = optTask.get(); assertNotNull(task); assertEquals(1, task.getId()); assertNotNull(task.getName()); assertNotNull(task.getDescription()); assertNotNull(task.getTestSteps()); assertNotNull(task.getCreator()); assertNotNull(task.getAssignee()); assertNotNull(task.getStatus()); assertNotNull(task.getPriority()); assertNotNull(task.getType()); }
@Test public void testCreateTask() throws Exception { TaskBuilder builder = taskService.createTask(); builder.creator(user); builder.project(project); builder.name(name); builder.description(desc); builder.testSteps(teststeps); builder.type(type); builder.estimated(8); builder.priority(priority); Task task = builder.build(); task.store(); assertNotNull(task); assertTrue(task.getId() > 0); assertEquals(name, task.getName()); assertEquals(desc, task.getDescription()); assertEquals(teststeps, task.getTestSteps()); assertEquals(user.getName(), task.getCreator().getName()); assertEquals(user.getName(), task.getAssignee().getName()); assertEquals("New", task.getStatus().getName()); assertEquals(priority, task.getPriority()); assertEquals(type, task.getType()); }
@Test public void testGetTaskByUserCompleted() throws Exception { List<Task> tasks = taskService.getTaskByUserCompleted(4); for (Task task : tasks) { assertNotNull(task); assertTrue(task.getId() > 0); assertNotNull(task.getName()); assertNotNull(task.getDescription()); assertNotNull(task.getTestSteps()); assertNotNull(task.getCreator()); assertNotNull(task.getAssignee()); assertNotNull(task.getStatus()); assertNotNull(task.getPriority()); assertNotNull(task.getType()); assertTrue( "Resolved".equals(task.getStatus().getName()) || "Closed".equals(task.getStatus().getName())); } }