Skip to content

Commit

Permalink
test: 봉사자, 모집자 이메일 찾기 Controller 테스트 코드 추가 (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeong-hyeok committed Jun 3, 2024
1 parent eba2660 commit a7de655
Showing 1 changed file with 39 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.pawwithu.connectdog.domain.auth.dto.request.*;
import com.pawwithu.connectdog.domain.auth.dto.response.EmailResponse;
import com.pawwithu.connectdog.domain.auth.dto.response.IntermediaryNameResponse;
import com.pawwithu.connectdog.domain.auth.dto.response.IntermediaryPhoneResponse;
import com.pawwithu.connectdog.domain.auth.dto.response.VolunteerPhoneResponse;
import com.pawwithu.connectdog.domain.auth.dto.response.*;
import com.pawwithu.connectdog.domain.auth.service.AuthService;
import com.pawwithu.connectdog.domain.auth.service.EmailService;
import com.pawwithu.connectdog.domain.volunteer.entity.SocialType;
Expand Down Expand Up @@ -169,4 +166,42 @@ void setUp() {
result.andExpect(status().isOk());
verify(authService, times(1)).isIntermediaryNameDuplicated(request);
}

@Test
void 이동봉사자_이메일_찾기() throws Exception {
//given
VolunteerPhoneRequest request = new VolunteerPhoneRequest("01000001111");
VolunteerEmailResponse response = new VolunteerEmailResponse("[email protected]");

//when
given(authService.findVolunteerEmail(request)).willReturn(response);
ResultActions result = mockMvc.perform(
post("/volunteers/search/email")
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(request))
);

//then
result.andExpect(status().isOk());
verify(authService, times(1)).findVolunteerEmail(request);
}

@Test
void 모집자_이메일_찾기() throws Exception {
//given
IntermediaryPhoneRequest request = new IntermediaryPhoneRequest("01000001111");
IntermediaryEmailResponse response = new IntermediaryEmailResponse("[email protected]");

//when
given(authService.findIntermediaryEmail(request)).willReturn(response);
ResultActions result = mockMvc.perform(
post("/intermediaries/search/email")
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(request))
);

//then
result.andExpect(status().isOk());
verify(authService, times(1)).findIntermediaryEmail(request);
}
}

0 comments on commit a7de655

Please sign in to comment.