diff --git a/build.gradle b/build.gradle
index 48daa19..cf6f443 100644
--- a/build.gradle
+++ b/build.gradle
@@ -33,7 +33,7 @@ dependencies {
testRuntimeOnly(
'org.junit.jupiter:junit-jupiter-engine:5.4.0'
)
- compile("com.epam.jdi:jdi-dark:1.0.3")
+ compile("com.epam.jdi:jdi-dark:1.1.7")
compile("org.slf4j:slf4j-nop:1.7.13")
}
diff --git a/pom.xml b/pom.xml
index 04b3f23..2287e89 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
com.epam.jdi
jdi-dark
- 1.0.3
+ 1.1.7
org.junit.jupiter
diff --git a/src/main/java/com/epam/jdi/httptests/example/TrelloService.java b/src/main/java/com/epam/jdi/httptests/example/TrelloService.java
index d21b065..b10d9dc 100644
--- a/src/main/java/com/epam/jdi/httptests/example/TrelloService.java
+++ b/src/main/java/com/epam/jdi/httptests/example/TrelloService.java
@@ -1,15 +1,13 @@
package com.epam.jdi.httptests.example;
import com.epam.http.annotations.*;
-import com.epam.http.requests.DataMethod;
-import com.epam.http.requests.RestMethod;
+import com.epam.http.requests.*;
import com.epam.jdi.httptests.example.dto.*;
-import java.util.Arrays;
import java.util.List;
-import static com.epam.http.requests.RequestDataFacrtory.pathParams;
import static io.restassured.http.ContentType.JSON;
+import static java.util.Arrays.asList;
/**
* Example of service for working with Trello API (Service for Project Dashboard creating)
@@ -29,10 +27,10 @@ public class TrelloService {
@ContentType(JSON)
@POST(BOARDS)
- public static DataMethod boardsPost;
+ public static RestDataMethod boardsPost;
- public static Board createBoard(Board board) {
- return boardsPost.callObject(board);
+ public static synchronized Board createBoard(Board board) {
+ return boardsPost.postAsData(board);
}
@ContentType(JSON)
@@ -40,7 +38,7 @@ public static Board createBoard(Board board) {
public static RestMethod getBoardById;
public static Board getBoard(String boardId) {
- return getBoardById.call(pathParams().add("board_id", boardId)).getRaResponse().as(Board.class);
+ return getBoardById.call(RequestDataFactory.pathParams().add("board_id", boardId)).getRaResponse().as(Board.class);
}
@ContentType(JSON)
@@ -72,7 +70,7 @@ public static Card addNewCardToBoard(Card card) {
public static RestMethod getCardBoard;
public static Board getCardBoard(String cardId) {
- return getCardBoard.call(pathParams().add("id", cardId)).getRaResponse().as(Board.class);
+ return getCardBoard.call(RequestDataFactory.pathParams().add("id", cardId)).getRaResponse().as(Board.class);
}
@ContentType(JSON)
@@ -109,7 +107,7 @@ public static Organization createOrganization(Organization organization) {
public static RestMethod getOrganizationBoards;
public static List getOrganizationBoards(Organization organization) {
- return Arrays.asList(getOrganizationBoards.call(pathParams().add("id", organization.id)).getRaResponse().as(Board[].class));
+ return asList(getOrganizationBoards.call(RequestDataFactory.pathParams().add("id", organization.id)).getRaResponse().as(Board[].class));
}
}
diff --git a/src/test/java/com/epam/jdi/httptests/example/ServiceTests.java b/src/test/java/com/epam/jdi/httptests/example/ServiceTests.java
index c71f22c..f37595a 100644
--- a/src/test/java/com/epam/jdi/httptests/example/ServiceTests.java
+++ b/src/test/java/com/epam/jdi/httptests/example/ServiceTests.java
@@ -1,14 +1,11 @@
package com.epam.jdi.httptests.example;
+import com.epam.http.requests.RequestDataFactory;
+import com.epam.http.requests.RestMethods;
import com.epam.http.response.RestResponse;
import org.junit.jupiter.api.*;
-import static com.epam.http.requests.RequestDataFacrtory.cookies;
-import static com.epam.http.requests.RequestDataFacrtory.pathParams;
-import static com.epam.http.requests.RequestDataFacrtory.requestData;
-import static com.epam.http.requests.RestMethods.GET;
import static com.epam.http.requests.ServiceInit.init;
-import static com.epam.http.response.ResponseStatusType.SERVER_ERROR;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -37,10 +34,9 @@ public void simpleRestTest() {
@Test
public void noServiceObjectTest() {
- RestResponse resp = GET(requestData(
- rd -> {
+ RestResponse resp = RestMethods.GET(RequestDataFactory.requestData(rd -> {
rd.uri = "https://httpbin.org/get";
- rd.addHeaders().addAll(new Object[][]{
+ rd.headerUpdater().addAll(new Object[][]{
{"Name", "Roman"},
{"Id", "TestTest"}
});
@@ -56,15 +52,14 @@ public void noServiceObjectTest() {
@Test
public void statusTestWithQueryInPath() {
- RestResponse resp = service.statusWithQuery.callWithNamedParams("503", "some");
+ RestResponse resp = service.statusWithQuery.pathParams("503", "some").call();
assertEquals(resp.getStatus().code, 503);
- assertEquals(resp.getStatus().type, SERVER_ERROR);
resp.isEmpty();
}
@Test
- public void retryRequestTest(){
- service.status.call(pathParams().add("status","500"))
+ public void retryRequestTest() {
+ service.status.call(RequestDataFactory.pathParams().add("status", "500"))
.assertThat()
.statusCode(500);
}
@@ -86,7 +81,7 @@ public void htmlBodyParseTest() {
@Test
public void cookiesTest() {
- RestResponse response = service.getCookies.call(cookies().add("additionalCookie", "test"));
+ RestResponse response = service.getCookies.call(RequestDataFactory.cookies().add("additionalCookie", "test"));
response.isOk()
.body("cookies.additionalCookie", equalTo("test"))
.body("cookies.session_id", equalTo("1234"))