@Test
public void testRegisterPerformedJob() throws Exception {

    try {
        UkelonnServiceProvider ukelonn = getUkelonnServiceSingleton();
        String username = "jad";
        UserManagementService useradmin = mock(UserManagementService.class);
        no.priv.bang.osgiservice.users.User user = new no.priv.bang.osgiservice.users.User(1, username, "jad@gmail.com", "Jane", "Doe");
        when(useradmin.getUser(anyString())).thenReturn(user);
        ukelonn.setUserAdmin(useradmin);
        Account account = ukelonn.getAccount(username);
        double oldBalance = account.getBalance();
        TransactionType jobtype = ukelonn.getJobTypes().get(0);
        PerformedTransaction performedJob = new PerformedTransaction(account, jobtype.getId(), jobtype.getTransactionAmount(), new Date());
        Account updatedAccount = ukelonn.registerPerformedJob(performedJob);
        assertThat(updatedAccount.getBalance()).isGreaterThan(oldBalance);
    } finally {
        restoreTestDatabase();
    }
}