Bumped RestAssured to 6.0.0

This commit is contained in:
Marcin Grzejszczak
2022-05-04 14:35:12 +02:00
parent b7a9e29062
commit adc513b45b
63 changed files with 1052 additions and 1224 deletions

View File

@@ -27,15 +27,10 @@ import org.springframework.cloud.contract.spec.ContractTemplate;
*/
public class CompositeContractTemplate implements ContractTemplate {
private final CustomHandlebarsContractTemplate custom = new CustomHandlebarsContractTemplate();
private final HandlebarsContractTemplate template = new HandlebarsContractTemplate();
@Override
public boolean startsWithTemplate(String text) {
if (this.custom.startsWithTemplate(text)) {
return true;
}
return template.startsWithTemplate(text);
}
@@ -113,7 +108,7 @@ public class CompositeContractTemplate implements ContractTemplate {
public String escapedBody() {
// WireMock doesn't support proper escaping of JSON body
// that's why we need to use our custom handlebars extension
return this.custom.escapedBody();
return this.template.escapedBody();
}
@Override

View File

@@ -1,105 +0,0 @@
/*
* Copyright 2013-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.contract.spec.internal;
import org.springframework.cloud.contract.spec.ContractTemplate;
/**
* Represents the structure of templates using Handlebars compatible with WireMock
* template model requirements.
*
* @author Marcin Grzejszczak
* @since 1.1.0*
* @deprecated use {@link HandlebarsContractTemplate}
*/
class CustomHandlebarsContractTemplate implements ContractTemplate {
@Override
public String openingTemplate() {
return "{{{";
}
@Override
public String closingTemplate() {
return "}}}";
}
@Override
public String url() {
return wrapped("request.url");
}
@Override
public String query(String key) {
return query(key, 0);
}
@Override
public String query(String key, int index) {
return wrapped("request.query." + key + ".[" + index + "]");
}
@Override
public String path() {
return wrapped("request.path");
}
@Override
public String path(int index) {
return wrapped("request.path.[" + index + "]");
}
@Override
public String header(String key) {
return header(key, 0);
}
@Override
public String header(String key, int index) {
return wrapped("request.headers." + key + ".[" + index + "]");
}
@Override
public String cookie(String key) {
return wrapped("request.cookies." + key);
}
@Override
public String body() {
return wrapped("request.body");
}
@Override
public String escapedBody() {
return wrapped("escapejsonbody");
}
@Override
public String escapedBody(String jsonPath) {
return body(jsonPath);
}
@Override
public String body(String jsonPath) {
return wrapped("jsonpath this \'" + jsonPath + "\'");
}
private String wrapped(String text) {
return openingTemplate() + text + closingTemplate();
}
}