HttpHeaders headers = new HttpHeaders();
headers.add("header", "headerValue");
headers.add("anotherName", "headerValue1");
headers.add("anotherName", "headerValue2");
ExtDirectPollResponse resp = ControllerUtil.performPollRequest(mockMvc,
"pollProvider", "messageRequestHeader2", "messageRequestHeader2", params,
headers);
assertThat(resp).isNotNull();
assertThat(resp.getType()).isEqualTo("event");
assertThat(resp.getName()).isEqualTo("messageRequestHeader2");
assertThat(resp.getData()).isEqualTo("1;headerValue1");
assertThat(resp.getWhere()).isNull();
assertThat(resp.getMessage()).isNull();
params.clear();
params.put("id", "2");
resp = ControllerUtil.performPollRequest(mockMvc, "pollProvider",
"messageRequestHeader2", "messageRequestHeader2", params, null, null,
true);
assertThat(resp).isNotNull();
assertThat(resp.getType()).isEqualTo("exception");
assertThat(resp.getName()).isEqualTo("messageRequestHeader2");
assertThat(resp.getData()).isNull();
assertThat(resp.getWhere()).isNull();
assertThat(resp.getMessage()).isEqualTo("Server Error");
params.clear();
params.put("id", "3");
headers = new HttpHeaders();
headers.add("header", "headerValue");
resp = ControllerUtil.performPollRequest(mockMvc, "pollProvider",
"messageRequestHeader2", "messageRequestHeader2", params, headers, null,
true);
assertThat(resp).isNotNull();
assertThat(resp.getType()).isEqualTo("exception");
assertThat(resp.getName()).isEqualTo("messageRequestHeader2");
assertThat(resp.getData()).isNull();
assertThat(resp.getWhere()).isNull();
assertThat(resp.getMessage()).isEqualTo("Server Error");
}