@Test
public void shouldBuildMappingWithExactUrlAndRequestHeaders() {
UrlMatchingStrategy urlStrategy = new UrlMatchingStrategy();
urlStrategy.setUrl("/match/this");
StubMapping mapping =
new MappingBuilder(POST, urlStrategy)
.withHeader("Content-Type", headerStrategyEqualTo("text/plain"))
.withHeader("Encoding", headerStrategyMatches("UTF-\\d"))
.withHeader("X-My-Thing", headerStrategyDoesNotMatch("[A-Z]+"))
.willReturn(new ResponseDefinitionBuilder())
.build();
assertThat(mapping.getRequest().getHeaders(), hasEntry("Content-Type", headerEqualTo("text/plain")));
assertThat(mapping.getRequest().getHeaders(), hasEntry("Encoding", headerMatches("UTF-\\d")));
assertThat(mapping.getRequest().getHeaders(), hasEntry("X-My-Thing", headerDoesNotMatch("[A-Z]+")));
}