@Test
public void testUpdateJob() {

    UkelonnService ukelonn = mock(UkelonnService.class);
    JobResource resource = new JobResource();
    // Create mock OSGi services to inject and inject it
    MockLogService logservice = new MockLogService();
    resource.logservice = logservice;
    resource.ukelonn = ukelonn;
    Account account = getJadAccount();
    Transaction job = getJadJobs().get(0);
    int jobId = job.getId();
    // Save initial values of the job for comparison later
    Integer originalTransactionTypeId = job.getTransactionType().getId();
    Date originalTransactionTime = job.getTransactionTime();
    double originalTransactionAmount = job.getTransactionAmount();
    // Find a different job type that has a different amount
    TransactionType newJobType = findJobTypeWithDifferentIdAndAmount(ukelonn, originalTransactionTypeId, originalTransactionAmount);
    // Create a new job object with a different jobtype and the same id
    Date now = new Date();
    UpdatedTransaction editedJob = new UpdatedTransaction(jobId, account.getAccountId(), newJobType.getId(), now, newJobType.getTransactionAmount());
    when(ukelonn.updateJob(any())).thenReturn(Arrays.asList(convertUpdatedTransaction(editedJob)));
    List<Transaction> updatedJobs = resource.doUpdateJob(editedJob);
    Transaction editedJobFromDatabase = updatedJobs.stream().filter(t->t.getId() == job.getId()).collect(Collectors.toList()).get(0);
    assertEquals(editedJob.getTransactionTypeId(), editedJobFromDatabase.getTransactionType().getId().intValue());
    assertThat(editedJobFromDatabase.getTransactionTime().getTime()).isGreaterThan(originalTransactionTime.getTime());
    assertEquals(editedJob.getTransactionAmount(), editedJobFromDatabase.getTransactionAmount(), 0.0);
}