-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathSesResourcesTest.java
36 lines (29 loc) · 1.22 KB
/
SesResourcesTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.acme.ses;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.any;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response.Status;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
@QuarkusTest
public class SesResourcesTest {
private static final String JSON = "{\"from\":\"%s\", \"to\":\"%s\", \"subject\":\"%s\", \"body\":\"%s\"}";
private final static String FROM_EMAIL = "[email protected]";
private final static String TO_EMAIL = "[email protected]";
@ParameterizedTest
@ValueSource(strings = {"sync", "async"})
void testResource(final String testedResource) {
//Send email
given()
.pathParam("resource", testedResource)
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.body(String.format(JSON, FROM_EMAIL, TO_EMAIL, "Hello from Quarkus", "Quarkus is awsome"))
.when()
.post("/{resource}/email")
.then()
.statusCode(Status.OK.getStatusCode())
.body(any(String.class));
}
}