Person john = new Person("John Doe", 20);
Person jane = new Person("Jane Doe", 20);
Map<String, Object> params = new HashMap<String, Object>();
params.put("name", john.getName());
ProcessInstance processInstanceJohn = ( ProcessInstance )
workingMemory.startProcess("org.drools.milestone", params);
workingMemory.insert(processInstanceJohn);
assertEquals(ProcessInstance.STATE_ACTIVE, processInstanceJohn.getState());
params = new HashMap<String, Object>();
params.put("name", jane.getName());
ProcessInstance processInstanceJane = ( ProcessInstance )
workingMemory.startProcess("org.drools.milestone", params);
workingMemory.insert(processInstanceJane);
assertEquals(ProcessInstance.STATE_ACTIVE, processInstanceJane.getState());
workingMemory.insert(jane);
assertEquals(ProcessInstance.STATE_ACTIVE, processInstanceJohn.getState());
assertEquals(ProcessInstance.STATE_COMPLETED, processInstanceJane.getState());
workingMemory.insert(john);
assertEquals(ProcessInstance.STATE_COMPLETED, processInstanceJohn.getState());
}