-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#42 - Introduce wrapper DTO and return duration of the run
Needs more work, however start to decouple the persisted results model from the returned model.
- Loading branch information
1 parent
2d4a77c
commit 3377e61
Showing
3 changed files
with
79 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package recce.server | ||
|
||
import io.micronaut.context.annotation.Factory | ||
import io.micronaut.runtime.server.EmbeddedServer | ||
import io.restassured.RestAssured | ||
import io.restassured.builder.RequestSpecBuilder | ||
import io.restassured.config.JsonConfig | ||
import io.restassured.filter.log.ResponseLoggingFilter | ||
import io.restassured.http.ContentType | ||
import io.restassured.path.json.config.JsonPathConfig | ||
import io.restassured.specification.RequestSpecification | ||
import jakarta.inject.Singleton | ||
|
||
@Factory | ||
class TestConfig { | ||
@Singleton | ||
fun restAssuredSpec(server: EmbeddedServer): RequestSpecification { | ||
// Yes, this is static configuration; seems no other way to do it with RestAssured | ||
RestAssured.config = RestAssured.config() | ||
.jsonConfig(JsonConfig.jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.DOUBLE)) | ||
|
||
return RequestSpecBuilder() | ||
.setContentType(ContentType.JSON) | ||
.setBaseUri(server.uri) | ||
.addFilter(ResponseLoggingFilter()) | ||
.build() | ||
} | ||
} |
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