public class HandlebarsTemplateProcessor extends Object implements TemplateProcessor, org.springframework.cloud.contract.spec.ContractTemplate
Constructor and Description |
---|
HandlebarsTemplateProcessor() |
public String transform(org.springframework.cloud.contract.spec.internal.Request request, String testContents)
TemplateProcessor
Request
and the test contents should perform a transformation
and return the converted test.transform
in interface TemplateProcessor
public boolean containsTemplateEntry(String line)
containsTemplateEntry
in interface TemplateProcessor
true
if the current line contains template related entry. E.g. for
Handlebars if a line contains {{{...}}} then it's considered to contain template
related entrypublic boolean containsJsonPathTemplateEntry(String line)
containsJsonPathTemplateEntry
in interface TemplateProcessor
true
if the current line contains template related entry for json
path processing. E.g. for Handlebars if a line contains {{{jsonpath ...}}} or
{{{jsonPath ...}}} then it's considered to contain template related entry for json
path processingpublic String jsonPathFromTemplateEntry(String line)
jsonPathFromTemplateEntry
in interface TemplateProcessor
$.a.b.c
. Returns empty string if there's no matching json path entrypublic boolean startsWithTemplate(String text)
startsWithTemplate
in interface org.springframework.cloud.contract.spec.ContractTemplate
public boolean startsWithEscapedTemplate(String text)
startsWithEscapedTemplate
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String openingTemplate()
openingTemplate
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String closingTemplate()
closingTemplate
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String escapedOpeningTemplate()
escapedOpeningTemplate
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String escapedClosingTemplate()
escapedClosingTemplate
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String url()
url
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String query(String key)
query
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String query(String key, int index)
query
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String path()
path
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String path(int index)
path
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String header(String key)
header
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String header(String key, int index)
header
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String cookie(String key)
cookie
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String body()
body
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String body(String jsonPath)
body
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String escapedUrl()
escapedUrl
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String escapedQuery(String key)
escapedQuery
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String escapedQuery(String key, int index)
escapedQuery
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String escapedPath()
escapedPath
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String escapedPath(int index)
escapedPath
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String escapedHeader(String key)
escapedHeader
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String escapedHeader(String key, int index)
escapedHeader
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String escapedCookie(String key)
escapedCookie
in interface org.springframework.cloud.contract.spec.ContractTemplate
public String escapedBody()
escapedBody
in interface org.springframework.cloud.contract.spec.ContractTemplate
Copyright © 2016–2022 Spring. All rights reserved.