|
1 | 1 | package io.specto.hoverfly.junit.core.model;
|
2 | 2 |
|
3 | 3 |
|
| 4 | +import static io.specto.hoverfly.junit.core.model.RequestFieldMatcher.newExactMatcher; |
| 5 | +import static java.util.Collections.singletonList; |
| 6 | +import static org.assertj.core.api.Assertions.assertThat; |
| 7 | + |
4 | 8 | import com.fasterxml.jackson.databind.ObjectMapper;
|
5 | 9 | import com.google.common.collect.ImmutableList;
|
6 | 10 | import com.google.common.collect.ImmutableMap;
|
7 | 11 | import com.google.common.collect.Lists;
|
8 | 12 | import com.google.common.collect.Sets;
|
9 | 13 | import com.google.common.io.Resources;
|
10 |
| -import org.junit.Test; |
11 |
| -import org.skyscreamer.jsonassert.JSONAssert; |
12 |
| -import org.skyscreamer.jsonassert.JSONCompareMode; |
13 |
| - |
14 | 14 | import java.net.URL;
|
15 | 15 | import java.nio.charset.StandardCharsets;
|
16 | 16 | import java.util.Arrays;
|
17 | 17 | import java.util.Collections;
|
18 |
| - |
19 |
| -import static io.specto.hoverfly.junit.core.model.RequestFieldMatcher.newExactMatcher; |
20 |
| -import static java.util.Collections.singletonList; |
21 |
| -import static org.assertj.core.api.Assertions.assertThat; |
| 18 | +import org.junit.Test; |
| 19 | +import org.skyscreamer.jsonassert.JSONAssert; |
| 20 | +import org.skyscreamer.jsonassert.JSONCompareMode; |
22 | 21 |
|
23 | 22 | public class SimulationTest {
|
24 | 23 |
|
25 |
| - |
| 24 | + |
26 | 25 | private final ObjectMapper objectMapper = new ObjectMapper();
|
27 | 26 |
|
28 | 27 | private final URL v5Resource = Resources.getResource("simulations/v5-simulation.json");
|
@@ -124,15 +123,18 @@ private Simulation getSimulationWithV5_2Matchers() {
|
124 | 123 | .query(ImmutableMap.of("key", singletonList(RequestFieldMatcher.newArrayMatcher(Arrays.asList("value1", "value2"), new ArrayMatcherConfig(true, true, false)))))
|
125 | 124 | // JWT Matcher
|
126 | 125 | .headers(ImmutableMap.of("Authorization", singletonList(RequestFieldMatcher.newJwtMatcher("{\"header\":{\"alg\":\"HS256\"},\"payload\":{\"sub\":\"1234567890\",\"name\":\"John Doe\"}}"))))
|
| 126 | + .body(singletonList(RequestFieldMatcher.newFormMatcher(ImmutableMap.of( |
| 127 | + "grant_type", singletonList(RequestFieldMatcher.newExactMatcher("authorization_code")), |
| 128 | + "client_assertion", singletonList(RequestFieldMatcher.newJwtMatcher("{\"header\":{\"alg\":\"HS256\"},\"payload\":{\"sub\":\"1234567890\",\"name\":\"John Doe\"}}")) |
| 129 | + )))) |
127 | 130 | .requiresState(ImmutableMap.of("requiresStateKey", "requiresStateValue"));
|
128 | 131 | Response.Builder responseBuilder = getTestResponseBuilder()
|
129 | 132 | .transitionsState(ImmutableMap.of("transitionsStateKey", "transitionsStateValue"))
|
130 | 133 | .removesState(ImmutableList.of("removesStateKey"))
|
131 | 134 | .fixedDelay(3000);
|
132 | 135 | HoverflyData data = getTestHoverflyData(requestBuilder, responseBuilder);
|
133 | 136 | HoverflyMetaData meta = new HoverflyMetaData();
|
134 |
| - Simulation simulation = new Simulation(data, meta); |
135 |
| - return simulation; |
| 137 | + return new Simulation(data, meta); |
136 | 138 | }
|
137 | 139 |
|
138 | 140 | private Simulation getLatestSimulation() {
|
|
0 commit comments