@Test
public void testCreateJobDefinition() throws Exception
{

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