@Test
public void testGenerateResponseShouldReturnTemplateResourceAndSetResponseHeadersWhenResponseFormatterDefined() throws Exception {

    //GIVEN
    ParameterList params = new ParameterList();
    responseFormatterDescriptors.add(responseFormatterDescriptor);
    mockTemplateResource();
    given(responseFormatterDescriptor.getParams()).willReturn(params);
    given(responseFormatterDescriptor.getResponseFormatter()).willReturn(responseFormatter);
    given(responseFormatter.formatResponse(wilmaRequest, response, templateResource, params)).willReturn(templateResource);
    //WHEN
    byte[] actual = underTest.generateResponse(request, response);
    //THEN
    verify(headerConfigurer).setResponseContentTypeAndStatus(response, responseDescriptorDTO);
    Assert.assertEquals(actual, templateResource);
}