UkelonnServiceProvider extends UkelonnServiceBase { @Override public List<Transaction> getJobs(int accountId) { return getTransactionsFromAccount(accountId, "/sql/query/jobs_last_n.sql", "job"); }  @Activate void activate(); @Reference(target = "(osgi.jndi.service.name=jdbc/ukelonn)") void setDataSource(DataSource datasource); @Override DataSource getDataSource(); @Reference void setUserAdmin(UserManagementService useradmin); @Reference void setLogservice(LogService logservice); @Override LogService getLogservice(); @Override List<Account> getAccounts(); @Override Account getAccount(String username); @Override Account registerPerformedJob(PerformedTransaction job); @Override List<TransactionType> getJobTypes(); @Override List<Transaction> getJobs(int accountId); @Override List<Transaction> getPayments(int accountId); @Override List<Transaction> deleteJobsFromAccount(int accountId, List<Integer> idsOfJobsToDelete); @Override List<Transaction> updateJob(UpdatedTransaction editedJob); @Override List<TransactionType> getPaymenttypes(); @Override Account registerPayment(PerformedTransaction payment); @Override List<TransactionType> modifyJobtype(TransactionType jobtype); @Override List<TransactionType> createJobtype(TransactionType jobtype); @Override List<TransactionType> modifyPaymenttype(TransactionType paymenttype); @Override List<TransactionType> createPaymenttype(TransactionType paymenttype); @Override Account addAccount(User user); @Override List<SumYear> earningsSumOverYear(String username); @Override List<SumYearMonth> earningsSumOverMonth(String username); @Override List<Notification> notificationsTo(String username); @Override void notificationTo(String username, Notification notification); Account mapAccount(ResultSet results);  }
@Test public void testGetJobs() { 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); List<Transaction> jobs = ukelonn.getJobs(account.getAccountId()); assertEquals(10, jobs.size()); }