@Test
public void testUpdateJobDefinition() throws Exception
{

    String namespace = NAMESPACE;
    String jobName = JOB_NAME;
    String activitiJobXml = getActivitiJobXml(NAMESPACE, JOB_NAME);
    JobDefinitionUpdateRequest request = new JobDefinitionUpdateRequest(null, activitiJobXml, null, null);
    JobDefinition jobDefinition = getJobDefinition(NAMESPACE, JOB_NAME);
    when(jobDefinitionService.updateJobDefinition(namespace, jobName, request, true)).thenReturn(jobDefinition);
    JobDefinition resultJobDefinition =
        jobDefinitionRestController.updateJobDefinition(namespace, jobName, new JobDefinitionUpdateRequest(null, activitiJobXml, null, null));
    // Verify the external calls.
    verify(jobDefinitionService).updateJobDefinition(namespace, jobName, request, true);
    verifyNoMoreInteractions(jobDefinitionService);
    // Validate the returned object.
    assertEquals(jobDefinition, resultJobDefinition);
}