Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. package CucumberJourney;
  2.  
  3. import static org.junit.Assert.assertEquals;
  4.  
  5. import dk.dtu.gbar.gitlab.shipment.Container;
  6. import dk.dtu.gbar.gitlab.shipment.Journey;
  7. import dk.dtu.gbar.gitlab.shipment.persistence.models.Client;
  8. import io.cucumber.java.en.Given;
  9. import io.cucumber.java.en.Then;
  10. import io.cucumber.java.en.When;
  11.  
  12. public class StepDefinition {
  13. Client client;
  14. Container container;
  15. Journey journey;
  16.  
  17. public void setUp() {
  18. // Why did I do this? Related to using a class in different methods
  19. client = new Client();
  20. container = new Container();
  21. journey = new Journey();
  22. }
  23.  
  24.  
  25. @Given("a container with id {string}")
  26. public void a_container_with_id(String containerId) {
  27. container.setContainerID(containerId);
  28. }
  29.  
  30. @Given("a client with name {string}, address {string}, refP {string}, email {string}")
  31. public void a_client_with_name_address_refP_email(String string, String string2, String string3, String string4) {
  32. client = new Client(string, string2, string3, string4);
  33. }
  34.  
  35. @When("journey is created for container with port of origin {string}, destination {string}, content {string}, company {string}")
  36. public void journey_is_created_for_container_with_port_of_origin_destination_content_company(String portOfOrigin, String destination, String containerContent, String company) {
  37. Journey journey = new Journey(portOfOrigin, destination, company, container.getContainerID());
  38. container.setContent(containerContent);
  39. journey.setClient(client);
  40. }
  41.  
  42. @Then("a journey is created for the container with id {string} and client")
  43. public void a_journey_is_created_for_the_container_with_id_and_client(String newJourneyId) {
  44. assertEquals(journey.getJourneyID(), newJourneyId);
  45. assertEquals(journey.getClient(), client);
  46. }
  47.  
  48. @Then("new journey id {string} is created")
  49. public void new_journey_id_is_created(String newJourneyId) {
  50. assertEquals(journey.getJourneyID(), newJourneyId);
  51. }
  52.  
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement