Skip to content

Commit 2a9574d

Browse files
committed
feat: ability to create the real request out of generic request
1 parent 5753c7c commit 2a9574d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

pom.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@
2525
<dependency>
2626
<groupId>org.projectlombok</groupId>
2727
<artifactId>lombok</artifactId>
28-
</dependency>
29-
<dependency>
30-
<groupId>com.jcabi</groupId>
31-
<artifactId>jcabi-matchers</artifactId>
32-
<scope>test</scope>
28+
<scope>compile</scope>
3329
</dependency>
3430
<dependency>
3531
<groupId>org.assertj</groupId>

src/main/java/ewc/utilities/testableio/core/GenericRequest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,15 @@ public String clientId() {
8383
public String queryId() {
8484
return this.query.apply(this);
8585
}
86+
87+
/**
88+
* Returns the request in the form that is required by the outside system and the real adapter.
89+
*
90+
* @param transformer Function that transform the generic request into the real request.
91+
* @param <R> The type of the real request.
92+
* @return The real request object, i.e. {@code HttpRequestEntity}.
93+
*/
94+
public <R> R realRequest(final Function<GenericRequest<T>, R> transformer) {
95+
return transformer.apply(this);
96+
}
8697
}

0 commit comments

Comments
 (0)