Example usage for org.springframework.mock.web MockHttpServletResponse addHeader

List of usage examples for org.springframework.mock.web MockHttpServletResponse addHeader

Introduction

In this page you can find the example usage for org.springframework.mock.web MockHttpServletResponse addHeader.

Prototype

@Override
    public void addHeader(String name, String value) 

Source Link

Usage

From source file:guru.nidi.ramltester.HeaderTest.java

@Test
public void existingRequiredWildcardResponseHeader() throws Exception {
    final MockHttpServletResponse response = jsonResponse(200);
    response.addHeader("x-", "w");
    assertNoViolations(test(aggregator, header, get("/resheader/reqwild"), response));
}

From source file:guru.nidi.ramltester.HeaderTest.java

@Test
public void undefinedResponseHeader() throws Exception {
    final MockHttpServletResponse response = jsonResponse(200, "\"hula\"");
    response.addHeader("a", "b");
    assertOneResponseViolationThat(test(aggregator, header, get("/data"), response),
            equalTo("Header 'a' on action(GET /data) is not defined"));
}

From source file:guru.nidi.ramltester.HeaderTest.java

@Test
public void illegallyRepeatResponseHeader() throws Exception {
    final MockHttpServletResponse response = jsonResponse(200, "\"hula\"");
    response.addHeader("req", "1");
    response.addHeader("req", "2");
    assertOneResponseViolationThat(test(aggregator, header, get("/resheader"), response),
            equalTo("Header 'req' on action(GET /resheader) is not repeat but found repeatedly"));
}

From source file:guru.nidi.ramltester.HeaderTest.java

@Test
public void allowedRepeatResponseHeader() throws Exception {
    final MockHttpServletResponse response = jsonResponse(200, "\"hula\"");
    response.addHeader("rep", "1");
    response.addHeader("rep", "2");
    response.addHeader("req", "xxx");
    assertNoViolations(test(aggregator, header, get("/resheader"), response));
}

From source file:guru.nidi.ramltester.HeaderTest.java

@Test
public void wildcardResponseHeader() throws Exception {
    final MockHttpServletResponse response = jsonResponse(200, "\"hula\"");
    response.addHeader("x-bla", "1");
    response.addHeader("x-hula", "2");
    response.addHeader("req", "3");
    assertNoViolations(test(aggregator, header, get("/resheader"), response));
}