UkelonnServiceProvider extends UkelonnServiceBase { static boolean passwordsEqualsAndNotEmpty(PasswordsWithUser passwords) { if (passwords.getPassword() == null || passwords.getPassword().isEmpty()) { return false; } return passwords.getPassword().equals(passwords.getPassword2()); }  @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 testPasswordsEqualAndNotEmpty() { PasswordsWithUser equalPasswords = new PasswordsWithUser(null, "zekret", "zekret"); assertTrue(UkelonnServiceProvider.passwordsEqualsAndNotEmpty(equalPasswords)); PasswordsWithUser differentPasswords = new PasswordsWithUser(null, "zekret", "secret"); assertFalse(UkelonnServiceProvider.passwordsEqualsAndNotEmpty(differentPasswords)); PasswordsWithUser firstPasswordNull = new PasswordsWithUser(null, null, "secret"); assertFalse(UkelonnServiceProvider.passwordsEqualsAndNotEmpty(firstPasswordNull)); PasswordsWithUser secondPasswordNull = new PasswordsWithUser(null, "secret", null); assertFalse(UkelonnServiceProvider.passwordsEqualsAndNotEmpty(secondPasswordNull)); PasswordsWithUser bothPasswordsNull = new PasswordsWithUser(null, null, null); assertFalse(UkelonnServiceProvider.passwordsEqualsAndNotEmpty(bothPasswordsNull)); PasswordsWithUser firstPasswordEmpty = new PasswordsWithUser(null, "", "secret"); assertFalse(UkelonnServiceProvider.passwordsEqualsAndNotEmpty(firstPasswordEmpty)); PasswordsWithUser secondPasswordEmpty = new PasswordsWithUser(null, "secret", ""); assertFalse(UkelonnServiceProvider.passwordsEqualsAndNotEmpty(secondPasswordEmpty)); PasswordsWithUser bothPasswordsEmpty = new PasswordsWithUser(null, "", ""); assertFalse(UkelonnServiceProvider.passwordsEqualsAndNotEmpty(bothPasswordsEmpty)); }