diff --git a/src/test/java/io/hexlet/typoreporter/web/SignupControllerIT.java b/src/test/java/io/hexlet/typoreporter/web/SignupControllerIT.java index d61ccc6c..7839e71e 100644 --- a/src/test/java/io/hexlet/typoreporter/web/SignupControllerIT.java +++ b/src/test/java/io/hexlet/typoreporter/web/SignupControllerIT.java @@ -22,6 +22,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.assertj.core.api.Assertions.assertThat; import static io.hexlet.typoreporter.test.Constraints.POSTGRES_IMAGE; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SpringBootTest @AutoConfigureMockMvc @@ -107,4 +108,22 @@ void createAccountWithWrongEmailDomain() throws Exception { .with(csrf())); assertThat(accountRepository.findAccountByEmail(wrongEmailDomain)).isEmpty(); } + + void createAccountWithWrongPassword() throws Exception { + String userName = "testUser"; + String wrongPass = "pass"; + String email = "test@test.ru"; + mockMvc.perform(post("/signup") + .param("username", userName) + .param("email", email) + .param("confirmEmail", email) + .param("password", wrongPass) + .param("confirmPassword", wrongPass) + .param("firstName", userName) + .param("lastName", userName) + .with(csrf())).andExpect((status().isFound())); + assertThat(accountRepository.findAccountByEmail(email)).isEmpty(); + + } + }