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
@Data | |
public class Contact { | |
private Long id; | |
private String type; | |
private String phone; | |
private String email; | |
} |
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
@Data // Lombok annotation | |
public class Employee { | |
private Long id; | |
private String firstName; | |
private String lastName; | |
@JsonSerialize(using = LocalDateSerializer.class) | |
@JsonDeserialize(using = LocalDateDeserializer.class) | |
private LocalDate joinDate; |
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
@RestController | |
@RequestMapping(path = "/api/v1/employees") | |
public class EmployeeRestController { | |
private EmployeeService employeeService; | |
public EmployeeRestController(EmployeeService employeeService) { | |
this.employeeService = employeeService; | |
} |
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
... | |
import cucumber.api.java.After; | |
import cucumber.api.java.Before; | |
... | |
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) | |
public class SpringIntegrationTest { | |
private static final Logger LOG = LoggerFactory.getLogger(SpringIntegrationTest.class); |
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
package org.arun.cucumber.sharingstate.stepdefs; | |
import static org.assertj.core.api.Assertions.assertThat; | |
import cucumber.api.java8.En; | |
import io.restassured.response.Response; | |
public class GlobalSteps extends AbstractSteps implements En { | |
public GlobalSteps() { |
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
import static io.restassured.RestAssured.given; | |
import cucumber.api.java8.En; | |
import io.cucumber.datatable.DataTable; | |
import io.restassured.http.ContentType; | |
import io.restassured.response.Response; | |
import java.util.List; | |
import org.arun.cucumber.sharingstate.dto.Contact; | |
import org.arun.cucumber.sharingstate.dto.Employee; |
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
import static io.restassured.RestAssured.given; | |
import cucumber.api.java8.En; | |
import io.cucumber.datatable.DataTable; | |
import java.util.List; | |
import org.arun.cucumber.sharingstate.dto.Contact; | |
import org.arun.cucumber.sharingstate.dto.Employee; | |
public class EmployeeSteps extends AbstractSteps implements En { |
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
import cucumber.api.java8.En; | |
import io.cucumber.datatable.DataTable; | |
import java.util.List; | |
import org.arun.cucumber.sharingstate.dto.Employee; | |
public class EmployeeSteps extends AbstractSteps implements En { | |
public EmployeeSteps() { | |
Given("user wants to create/update a employee with the following attributes", (DataTable employeeDt) -> { |
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
package org.arun.cucumber.sharingstate.stepdefs; | |
import static org.arun.cucumber.sharingstate.config.TestContext.CONTEXT; | |
import org.arun.cucumber.sharingstate.config.TestContext; | |
import org.springframework.boot.web.server.LocalServerPort; | |
public abstract class AbstractSteps { | |
@LocalServerPort |
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
package org.arun.cucumber.sharingstate.config; | |
import static io.restassured.RestAssured.given; | |
import static java.lang.ThreadLocal.withInitial; | |
import io.restassured.response.Response; | |
import io.restassured.specification.RequestSpecification; | |
import java.util.HashMap; | |
import java.util.Map; |