generator.server.springboot.cucumber.rest.ElementAssertions.mustache Maven / Gradle / Ivy
package {{packageName}}.cucumber.rest;
import static org.assertj.core.api.Assertions.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import net.minidev.json.JSONArray;
class ElementAssertions {
private final String jsonPath;
public ElementAssertions(String jsonPath) {
this.jsonPath = buildJsonPath(jsonPath);
assertThat(CucumberRestTestContext.getElement(this.jsonPath)).as("Can't find " + this.jsonPath + " in response").isNotNull();
}
private String buildJsonPath(String jsonPath) {
if (jsonPath == null) {
return "$";
}
return jsonPath;
}
void withValue(Object value) {
assertPathValue(jsonPath, value);
}
void containingExactly(List