APILocator.getWorkflowAPI().saveSchemeForStruct(st, scheme);
// send the Rest api call
User sysuser=APILocator.getUserAPI().getSystemUser();
User bill=APILocator.getUserAPI().loadUserById("dotcms.org.2806");
Role billrole=APILocator.getRoleAPI().getUserRole(bill);
ClientResponse response=contRes.path("/Save%20and%20Assign/1/wfActionComments/please%20do%20this%20for%20me/wfActionAssign/"+billrole.getId())
.type(MediaType.APPLICATION_JSON_TYPE)
.header(authheader, authvalue).put(ClientResponse.class,
new JSONObject()
.put("stInode", st.getInode())
.put("languageId", 1)
.put(field.getVelocityVarName(), "test title "+salt)
.toString());
Assert.assertEquals(200, response.getStatus());
Contentlet cont = APILocator.getContentletAPI().find(response.getHeaders().getFirst("inode"), sysuser, false);
Assert.assertNotNull(cont);
Assert.assertTrue(InodeUtils.isSet(cont.getIdentifier()));
// must be in the first step
Assert.assertEquals(step1.getId(), APILocator.getWorkflowAPI().findStepByContentlet(cont).getId());
boolean assigned=false;
HashMap<String, Object> map = new HashMap<String,Object>();
map.put("assignedTo",billrole.getId());
for(WorkflowTask task : APILocator.getWorkflowAPI().searchTasks(new WorkflowSearcher(map, sysuser))) {
if(task.getWebasset().equals(cont.getIdentifier())) {
assigned=true;
Assert.assertEquals("please do this for me",task.getDescription());
break;