Language Injections
Various language injections are provided by the WireMocha plugin that extend the bundled configuration.
In general, injections require the IntelliLang plugin to be installed (bundled by default), while XPath injections require the XPathView + XSLT plugin,
and Handlebars injections require the Handlebars/Mustache plugin. All of these plugins are optional, but in case any of them is disabled or not installed, the corresponding functionality of WireMocha won’t be available.
Notes:
- Injecting multiple separate Handlebars fragments into the same literal is available is since v1.0.2.
- Known issue: if a string literal contains a raw block (
{{{{
), although Handlebars is injected into it, sequent Handlebars fragments in the same literal are highlighted as generic expressions and not actual helpers, and lack features like code completion. This happens via the IDE’s own language injection feature as well.
Java
These are all enabled by default, and can be disabled individually under IDE Settings > Editor > Language Injections. They are by default available since v1.0.0, unless stated otherwise.
Category | Location | Injected Language | Comment |
---|---|---|---|
WireMock URL Matchers | WireMock.urlMatching() WireMock.urlPathMatching() | RegExp | |
WireMock String Value Matchers | WireMock.matching() WireMock.notMatching() | RegExp | |
WireMock JSON Matchers | WireMock.equalToJson() | JSON | |
WireMock XML Matchers | WireMock.equalToXml() | XML | |
WireMock JSON Path Matchers | WireMock.matchingJsonPath() | JSONPath | |
WireMock XPath Matchers | WireMock.matchingXPath() WireMock.matchesXPathWithSubMatcher() | XPath | |
WireMock JSON Response Body | WireMock.okJson() WireMock.jsonResponse() | JSON | |
WireMock XML Response Body | WireMock.okXml() WireMock.okTextXml() | XML | |
Response definition | Following methods of ResponseDefinitionBuilder :withBody() withBodyFile() withBase64Body() withHeader() proxiedFrom() | Handlebars |
JSON
Injections into JSON mapping files are generally available since v1.0.1. At the moment, the injection into these properties cannot be disabled.
Property | Injected Language |
---|---|
matches doesNotMatch urlPattern urlPathPattern placeholderOpeningDelimiterRegex placeholderClosingDelimiterRegex | RegExp |
equalToJson | JSON |
equalToXml | XML |
matchesJsonPath matchesJsonPath.expression | JSONPath |
matchesXPath matchesXPath.expression | XPath |
body bodyFileName base64Body proxyBaseUrl literals within response.headers | Handlebars |