@Test
public void testRegisterJob() throws Exception {

    // Create the request
    Account account = getJadAccount();
    double originalBalance = account.getBalance();
    List<TransactionType> jobTypes = getJobtypes();
    PerformedTransaction job = new PerformedTransaction(account, jobTypes.get(0).getId(), jobTypes.get(0).getTransactionAmount(), new Date());
    // Create the request and response for the Shiro login
    HttpServletRequest request = mock(HttpServletRequest.class);
    HttpSession session = mock(HttpSession.class);
    when(request.getSession()).thenReturn(session);
    HttpServletResponse response = mock(HttpServletResponse.class);
    // Create the object to be tested
    JobResource resource = new JobResource();
    // Log the user in to shiro
    loginUser(request, response, "jad", "1ad");
    // Create mock OSGi services to inject and inject it
    MockLogService logservice = new MockLogService();
    resource.logservice = logservice;
    // Inject fake OSGi service UkelonnService
    UkelonnService ukelonn = mock(UkelonnService.class);
    Account accountWithUpdatedBalance = copyAccount(account);
    accountWithUpdatedBalance.setBalance(account.getBalance() + job.getTransactionAmount());
    when(ukelonn.registerPerformedJob(any())).thenReturn(accountWithUpdatedBalance);
    resource.ukelonn = ukelonn;
    // Run the method under test
    Account result = resource.doRegisterJob(job);
    // Check the response
    assertEquals("jad", result.getUsername());
    assertThat(result.getBalance()).isGreaterThan(originalBalance);
}