Search in sources :

Example 1 with ResponseBodyAdvice

use of org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice in project spring-framework by spring-projects.

the class TestPathHelper method verifyResponseBodyAdvice.

@SuppressWarnings("unchecked")
private void verifyResponseBodyAdvice(Object bean) {
    assertNotNull(bean);
    Object value = new DirectFieldAccessor(bean).getPropertyValue("responseBodyAdvice");
    assertNotNull(value);
    assertTrue(value instanceof List);
    List<ResponseBodyAdvice> converters = (List<ResponseBodyAdvice>) value;
    assertTrue(converters.get(0) instanceof JsonViewResponseBodyAdvice);
}
Also used : JsonViewResponseBodyAdvice(org.springframework.web.servlet.mvc.method.annotation.JsonViewResponseBodyAdvice) ResponseBodyAdvice(org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) JsonViewResponseBodyAdvice(org.springframework.web.servlet.mvc.method.annotation.JsonViewResponseBodyAdvice) List(java.util.List)

Example 2 with ResponseBodyAdvice

use of org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice in project spring-framework by spring-projects.

the class TestPathHelper method verifyRequestResponseBodyAdvice.

@SuppressWarnings("unchecked")
private void verifyRequestResponseBodyAdvice(Object bean) {
    assertNotNull(bean);
    Object value = new DirectFieldAccessor(bean).getPropertyValue("requestResponseBodyAdvice");
    assertNotNull(value);
    assertTrue(value instanceof List);
    List<ResponseBodyAdvice> converters = (List<ResponseBodyAdvice>) value;
    assertTrue(converters.get(0) instanceof JsonViewRequestBodyAdvice);
    assertTrue(converters.get(1) instanceof JsonViewResponseBodyAdvice);
}
Also used : JsonViewResponseBodyAdvice(org.springframework.web.servlet.mvc.method.annotation.JsonViewResponseBodyAdvice) ResponseBodyAdvice(org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice) JsonViewRequestBodyAdvice(org.springframework.web.servlet.mvc.method.annotation.JsonViewRequestBodyAdvice) DirectFieldAccessor(org.springframework.beans.DirectFieldAccessor) JsonViewResponseBodyAdvice(org.springframework.web.servlet.mvc.method.annotation.JsonViewResponseBodyAdvice) List(java.util.List)

Aggregations

List (java.util.List)2 DirectFieldAccessor (org.springframework.beans.DirectFieldAccessor)2 JsonViewResponseBodyAdvice (org.springframework.web.servlet.mvc.method.annotation.JsonViewResponseBodyAdvice)2 ResponseBodyAdvice (org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice)2 JsonViewRequestBodyAdvice (org.springframework.web.servlet.mvc.method.annotation.JsonViewRequestBodyAdvice)1