1 package org.jbpm.taskmgmt.def; 2 3 import junit.framework.*; 4 5 public class TaskMgmtDefinitionTest extends TestCase { 6 7 TaskMgmtDefinition taskMgmtDefinition = new TaskMgmtDefinition(); 8 Swimlane buyer = new Swimlane("buyer"); 9 Swimlane seller = new Swimlane("seller"); 10 Task laudry = new Task("laundry"); 11 Task dishes = new Task("dishes"); 12 13 public void testTaskMgmtDefinitionAddSwimlanes() { 14 taskMgmtDefinition.addSwimlane(buyer); 15 taskMgmtDefinition.addSwimlane(seller); 16 assertEquals(2, taskMgmtDefinition.getSwimlanes().size()); 17 assertTrue(taskMgmtDefinition.getSwimlanes().containsValue(buyer)); 18 assertTrue(taskMgmtDefinition.getSwimlanes().containsValue(seller)); 19 } 20 21 public void testTaskMgmtDefinitionAddSwimlaneInverseReference() { 22 taskMgmtDefinition.addSwimlane(buyer); 23 taskMgmtDefinition.addSwimlane(seller); 24 assertSame(taskMgmtDefinition, buyer.getTaskMgmtDefinition()); 25 assertSame(taskMgmtDefinition, seller.getTaskMgmtDefinition()); 26 } 27 28 public void testTaskMgmtDefinitionAddTasks() { 29 taskMgmtDefinition.addTask(laudry); 30 taskMgmtDefinition.addTask(dishes); 31 assertEquals(2, taskMgmtDefinition.getTasks().size()); 32 assertTrue(taskMgmtDefinition.getTasks().containsValue(laudry)); 33 assertTrue(taskMgmtDefinition.getTasks().containsValue(dishes)); 34 } 35 36 public void testTaskMgmtDefinitionAddTasksInverseReference() { 37 taskMgmtDefinition.addTask(laudry); 38 taskMgmtDefinition.addTask(dishes); 39 assertSame(taskMgmtDefinition, laudry.getTaskMgmtDefinition()); 40 assertSame(taskMgmtDefinition, dishes.getTaskMgmtDefinition()); 41 } 42 } 43 | Popular Tags |