Last active
April 22, 2018 04:43
-
-
Save LeoHeo/b41db3139eaea420e0250543c1072cd3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(SpringRunner.class) | |
@SpringBootTest | |
@AutoConfigureMockMvc | |
public class UserControllerTests { | |
// injection 코드들 생략... | |
@Test | |
public void 인자가_아무것도_없을때_400() throws Exception { | |
this.mockMvc.perform(post("/user/signup")) | |
.andExpect(status().isBadRequest()); | |
} | |
@Test | |
public void 골뱅이가 없는 이메일_format_400() throws Exception { | |
UserSaveDto userSaveDto = new UserSaveDto(); | |
userSaveDto.setUsername("hjh"); | |
userSaveDto.setAddress("seoul"); | |
userSaveDto.setPassword("123456"); | |
userSaveDto.setEmail("hjh544"); | |
userSaveDto.setProvider(Provider.create("test")); | |
this.mockMvc.perform( | |
post("/user/signup") | |
.contentType(MediaType.APPLICATION_JSON_UTF8) | |
.content(objectMapper.writeValueAsString(userSaveDto))) | |
.andExpect(status().isBadRequest()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment