-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c03a83b
commit 1eaca77
Showing
4 changed files
with
50 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
44 changes: 38 additions & 6 deletions
44
src/test/java/io/proyection/projection/Integration/Test/UserIntegrationTest.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,70 @@ | ||
package io.proyection.projection.Integration.Test; | ||
|
||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import org.junit.Assert; | ||
import org.mockito.Mock; | ||
|
||
import cucumber.api.java.en.Given; | ||
import cucumber.api.java.en.Then; | ||
import cucumber.api.java.en.When; | ||
import io.proyection.projection.domain.User; | ||
import io.proyection.projection.service.UserService; | ||
|
||
public class UserIntegrationTest { | ||
|
||
private final UserService userService = new UserService(); | ||
private static User user = new User(); | ||
private String mensaje = ""; | ||
private String nombre = ""; | ||
|
||
@Mock | ||
private HttpServletResponse response; | ||
|
||
@Given("^user name is \"([^\"]*)\"$") | ||
public void user_name_is(String arg1) throws Throwable { | ||
// Write code here that turns the phrase above into concrete actions | ||
user.setUsername(nombre); | ||
user.setPassword("test"); | ||
Assert.assertTrue(user.getUsername() == ""); | ||
} | ||
|
||
@When("^post method save user is \"([^\"]*)\"$") | ||
public void post_method_save_user_is(String arg1) throws Throwable { | ||
// Write code here that turns the phrase above into concrete actions | ||
try { | ||
userService.saveUser(user); | ||
mensaje = "name is compulsory"; | ||
Assert.assertTrue(true); | ||
} catch (Exception e) { | ||
System.out.println("Error: "+e.getMessage()); | ||
} | ||
} | ||
|
||
@Then("^the user recieves the message \"([^\"]*)\"$") | ||
public void the_user_recieves_the_message(String arg1) throws Throwable { | ||
// Write code here that turns the phrase above into concrete actions | ||
Assert.assertTrue(mensaje == arg1); | ||
} | ||
|
||
@Given("^user password is \"([^\"]*)\"$") | ||
public void user_password_is(String arg1) throws Throwable { | ||
// Write code here that turns the phrase above into concrete actions | ||
user.setPassword(nombre); | ||
user.setUsername("test00"); | ||
Assert.assertTrue(user.getPassword() == ""); | ||
} | ||
|
||
@When("^post method save users is \"([^\"]*)\"$") | ||
public void post_method_save_users_is(String arg1) throws Throwable { | ||
// Write code here that turns the phrase above into concrete actions | ||
try { | ||
userService.saveUser(user); | ||
mensaje = "password is compulsory"; | ||
Assert.assertTrue(true); | ||
} catch (Exception e) { | ||
System.out.println("Error: "+e.getMessage()); | ||
} | ||
|
||
} | ||
|
||
@Then("^the user recieves the messagesito \"([^\"]*)\"$") | ||
public void the_user_recieves_the_messagesito(String arg1) throws Throwable { | ||
// Write code here that turns the phrase above into concrete actions | ||
Assert.assertTrue(mensaje == arg1); | ||
} | ||
} |