/**
  * Checks if a member with the same email address is already registered. This is the only way to
  * easily capture the "@UniqueConstraint(columnNames = "email")" constraint from the Member class.
  *
  * @param email The email to check
  * @return True if the email already exists, and false otherwise
  */
 public boolean emailAlreadyExists(String email) {
   Member member = null;
   try {
     member = repository.findByEmail(email);
   } catch (NoResultException e) {
     // ignore
   }
   return member != null;
 }
 @GET
 @Path("/{id:[0-9][0-9]*}")
 @Produces(MediaType.APPLICATION_JSON)
 public Member lookupMemberById(@PathParam("id") long id) {
   Member member = repository.findById(id);
   if (member == null) {
     throw new WebApplicationException(Response.Status.NOT_FOUND);
   }
   return member;
 }
  @Test
  public void registerMemberTest() throws Exception {
    Assert.assertNotNull(memberRegistration);
    Assert.assertNotNull(memberRepository);

    Member member = new Member();
    member.setName("John Doe");
    member.setEmail("*****@*****.**");
    member.setPhoneNumber("1234567890");

    memberRegistration.register(member);

    Member found = memberRepository.findByEmail("*****@*****.**");
    Assert.assertNotNull(found);
    Assert.assertEquals("Dummy name", found.getName());
  }
 @GET
 @Produces(MediaType.APPLICATION_JSON)
 public List<Member> listAllMembers() {
   return repository.findAllOrderedByName();
 }