UkelonnServiceProvider extends UkelonnServiceBase { @Override public List<TransactionType> getPaymenttypes() { List<TransactionType> paymenttypes = new ArrayList<>(); try(Connection connection = datasource.getConnection()) { try(PreparedStatement statement = connection.prepareStatement("select * from transaction_types where transaction_is_wage_payment=true")) { try(ResultSet resultSet = statement.executeQuery()) { if (resultSet != null) { while (resultSet.next()) { TransactionType transactiontype = UkelonnServiceProvider.mapTransactionType(resultSet); paymenttypes.add(transactiontype); } } } } } catch (SQLException e) { logError("Error getting payment types from the database", e); } return paymenttypes; }  @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 testGetPaymenttypes() { UkelonnService ukelonn = getUkelonnServiceSingleton(); List<TransactionType> paymenttypes = ukelonn.getPaymenttypes(); assertEquals(2, paymenttypes.size()); }