Source:
<code>public void setTaskPropertyCommandTest() throws Exception { SetTaskPropertyCommand cmd; int taskId = 1; String userId = "user"; FaultDataImpl faultData = new FaultDataImpl(); faultData.setAccessType(AccessType.Inline); faultData.setContent("skinned shins".getBytes()); faultData.setFaultName("Whoops!"); faultData.setType("skates"); List<I18NText> textList = new ArrayList<I18NText>(); I18NText text = new I18NTextImpl("nl-NL", "Stroopwafel!"); textList.add(text); Object [][] testData = { { FAULT_PROPERTY, faultData }, { OUTPUT_PROPERTY, new Object() }, { PRIORITY_PROPERTY, 23 }, { TASK_NAMES_PROPERTY, textList }, { EXPIRATION_DATE_PROPERTY, new Date() }, { DESCRIPTION_PROPERTY, new ArrayList<I18NText>() }, { SKIPPABLE_PROPERTY, false }, { SUB_TASK_STRATEGY_PROPERTY, SubTasksStrategy.EndParentOnAllSubTasksEnd } }; TaskContext mockContext = mock(TaskContext.class); TaskInstanceService mockTaskService = mock(TaskInstanceService.class); UserGroupCallback mockUserGroupCallback = mock(UserGroupCallback.class); when(mockContext.getTaskInstanceService()).thenReturn(mockTaskService); when(mockContext.getUserGroupCallback()).thenReturn(mockUserGroupCallback); when(mockUserGroupCallback.existsUser(anyString())).thenReturn(false); for( Object data : testData ) { int property = (Integer) data[0]; cmd = new SetTaskPropertyCommand(taskId, userId, property, data[1]); try { cmd.execute(mockContext); <START> } catch (IllegalArgumentException e) { <END> } } }</code><technical_language>If aim is avoid exception doCallbackUserOperation method, exception asserted exact counting with; i.e. this piece of code swallow a IllegalArgumentException</technical_language>

Target:
public void setTaskPropertyCommandTest() throws Exception { SetTaskPropertyCommand cmd; int taskId = 1; String userId = "user"; FaultDataImpl faultData = new FaultDataImpl(); faultData.setAccessType(AccessType.Inline); faultData.setContent("skinned shins".getBytes()); faultData.setFaultName("Whoops!"); faultData.setType("skates"); List<I18NText> textList = new ArrayList<I18NText>(); I18NText text = new I18NTextImpl("nl-NL", "Stroopwafel!"); textList.add(text); Object [][] testData = { { FAULT_PROPERTY, faultData }, { OUTPUT_PROPERTY, new Object() }, { PRIORITY_PROPERTY, 23 }, { TASK_NAMES_PROPERTY, textList }, { EXPIRATION_DATE_PROPERTY, new Date() }, { DESCRIPTION_PROPERTY, new ArrayList<I18NText>() }, { SKIPPABLE_PROPERTY, false }, { SUB_TASK_STRATEGY_PROPERTY, SubTasksStrategy.EndParentOnAllSubTasksEnd } }; TaskContext mockContext = mock(TaskContext.class); TaskInstanceService mockTaskService = mock(TaskInstanceService.class); UserGroupCallback mockUserGroupCallback = mock(UserGroupCallback.class); when(mockContext.getTaskInstanceService()).thenReturn(mockTaskService); when(mockContext.getUserGroupCallback()).thenReturn(mockUserGroupCallback); when(mockUserGroupCallback.existsUser(anyString())).thenReturn(false); for( Object data : testData ) { int property = (Integer) data[0]; cmd = new SetTaskPropertyCommand(taskId, userId, property, data[1]); try { cmd.execute(mockContext); } catch (IllegalArgumentException e) { assertTrue(e.getMessage().startsWith("User user was not found in callback ")); } } }