@Test
 public void create() throws Exception {
   Member member = new Member();
   member.setEmail("*****@*****.**");
   member.setName("keesun");
   ConfirmMail mail = new ConfirmMail(member);
   assertThat(mail, isAbout(member));
 }
  @Test
  public void testExtractEmailArrayForm() {
    Member member = new Member();
    member.setEmail("*****@*****.**");
    String[] mails = EmailExtractUtil.extractEmailArrayForm(member);
    assertThat(mails.length, is(1));

    member = new Member();
    member.setEmail("whiteship20om");
    mails = EmailExtractUtil.extractEmailArrayForm(member);
    assertThat(mails, is(nullValue()));
  }
  @Test
  public void testExtractEmailCollectionFrom() {
    Member member = new Member();
    member.setEmail("*****@*****.**");
    Collection<String> mails = EmailExtractUtil.extractEmailCollectionFrom(member);
    assertThat(mails.size(), is(1));

    member = new Member();
    member.setEmail("whiteship20om");
    mails = EmailExtractUtil.extractEmailCollectionFrom(member);
    assertThat(mails, is(nullValue()));
  }
  @Test
  public void addMember() {
    Member member = new Member();
    member.setEmail("*****@*****.**");
    member.setPassword("pass");

    memberService.add(member);

    verify(mockPasswordEncoder).encodePassword("pass", null);
    verify(mockMemberRepository).add(member);
    verify(mockSendMailService).sendMessage(Matchers.<SpringSproutMessage>anyObject());
    assertThat(member.getAvatar(), is(CoreMatchers.<Object>notNullValue()));
  }
  @Test
  public void confirmMember() throws Exception {
    Member member = new Member();
    String email = "*****@*****.**";
    member.setEmail(email);
    String authCode = member.getAuthCode();

    assertThat(member.getStatus(), is(MemberStatus.JOIN_WAIT));
    assertThat(member.getJoined(), is(nullValue()));
    assertThat(member.getRoles().size(), is(0));

    Role mockMemberRole = new Role();
    mockMemberRole.setName("member");
    when(mockRoleRepository.getMemberRole()).thenReturn(mockMemberRole);
    when(mockMemberRepository.findByEmail(email)).thenReturn(member);

    memberService.confimMember(email, authCode);
    assertThat(member.getStatus(), is(MemberStatus.JOIN));
    assertThat(member.getRoles().size(), is(1));
    assertThat(member.getJoined(), is(notNullValue()));
    assertThat(member.getRoles().iterator().next(), is(mockMemberRole));
  }
 @Test
 public void testExtractMessageAllowedEmailCollectionFrom() {
   List<Member> members = new ArrayList<Member>();
   Member member = new Member();
   member.setIsAllowedGoogleTalk(true);
   member.setEmail("*****@*****.**");
   members.add(member);
   member = new Member();
   member.setIsAllowedGoogleTalk(false);
   member.setEmail("*****@*****.**");
   members.add(member);
   member = new Member();
   member.setIsAllowedGoogleTalk(true);
   member.setEmail("whiteship20om");
   members.add(member);
   Collection<String> mails = EmailExtractUtil.extractMessageAllowedEmailCollectionFrom(members);
   assertThat(mails.size(), is(1));
 }
  @Test
  public void testExtractMailAllowedEmailFrom() {
    List<Member> members = new ArrayList<Member>();
    Member member = new Member();
    member.setIsAllowedEmail(true);
    member.setEmail("*****@*****.**");
    members.add(member);
    member = new Member();
    member.setIsAllowedEmail(false);
    member.setEmail("*****@*****.**");
    members.add(member);
    member = new Member();
    member.setIsAllowedEmail(true);
    member.setEmail("whiteship20om");
    members.add(member);

    String[] mails = EmailExtractUtil.extractMailAllowedEmailFrom(members);
    assertThat(mails.length, is(1));
  }