/* (non-Javadoc) * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(GroupMember anotherGroupMember) { String memberName = member.getFirstName() + " " + member.getMiddleName() + " " + member.getLastName(); Account anotherMember = anotherGroupMember.getMember(); String anotherName = anotherMember.getFirstName() + " " + anotherMember.getMiddleName() + " " + anotherMember.getLastName(); return memberName.toLowerCase().compareTo(anotherName.toLowerCase()); } // - compareTo
@Test public void testSendAccountBean() throws Exception { MockEndpoint endpoint = getMockEndpoint("mock:results"); endpoint.expectedMinimumMessageCount(1); Account account = new Account(); account.setId(123); account.setFirstName("James"); account.setLastName("Strachan"); account.setEmailAddress("*****@*****.**"); template.sendBody("direct:start", account); assertMockEndpointsSatisfied(); // now lets poll that the account has been inserted List body = template.requestBody( "ibatis:selectAllAccounts?statementType=QueryForList", null, List.class); assertEquals("Wrong size: " + body, 1, body.size()); Account actual = assertIsInstanceOf(Account.class, body.get(0)); assertEquals("Account.getFirstName()", "James", actual.getFirstName()); assertEquals("Account.getLastName()", "Strachan", actual.getLastName()); log.info("Found: " + actual); }
@Transactional public void createAccount(Account user) throws UsernameAlreadyInUseException { try { jdbcTemplate.update( "insert into Account (firstName, lastName, username, password) values (?, ?, ?, ?)", user.getFirstName(), user.getLastName(), user.getUsername(), passwordEncoder.encodePassword(user.getPassword(), null)); } catch (DuplicateKeyException e) { throw new UsernameAlreadyInUseException(user.getUsername()); } }