Buggy code:
public class MappingJackson2HttpMessageConverterTests { protected static final String NEWLINE_SYSTEM_PROPERTY = System . getProperty ( "line.separator" ) ; private final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter ( ) ; @ Test public void canRead ( ) { } @ Test public void canWrite ( ) { } @ Test public void canReadAndWriteMicroformats ( ) { } @ Test public void readTyped ( ) throws IOException { } @ Test @ SuppressWarnings ( "unchecked" ) public void readUntyped ( ) throws IOException { } @ Test public void write ( ) throws IOException { } @ Test public void writeUTF16 ( ) throws IOException { } @ Test ( expected = HttpMessageNotReadableException . class ) public void readInvalidJson ( ) throws IOException { } @ Test ( expected = HttpMessageNotReadableException . class ) public void readValidJsonWithUnknownProperty ( ) throws IOException { } @ Test @ SuppressWarnings ( "unchecked" ) public void readGenerics ( ) throws IOException { } @ Test @ SuppressWarnings ( "unchecked" ) public void readParameterizedType ( ) throws IOException { } @ Test public void prettyPrint ( ) throws Exception { } @ Test public void prefixJson ( ) throws Exception { } @ Test public void prefixJsonCustom ( ) throws Exception { } @ Test public void jsonView ( ) throws Exception { MockHttpOutputMessage outputMessage = new MockHttpOutputMessage ( ) ; MappingJackson2HttpMessageConverterTests . JacksonViewBean bean = new MappingJackson2HttpMessageConverterTests . JacksonViewBean ( ) ; bean . setWithView1 ( "with" ) ; bean . setWithView2 ( "with" ) ; bean . setWithoutView ( "without" ) ; <START_BUG> MappingJacksonValueHolder jsv = new MappingJacksonValueHolder ( bean , MappingJackson2HttpMessageConverterTests . MyJacksonView1 . class ) ; <END_BUG> this . converter . writeInternal ( jsv , outputMessage ) ; String result = outputMessage . getBodyAsString ( Charset . forName ( "UTF-8" ) ) ; assertTrue ( result . contains ( "\"withView1\":\"with\"" ) ) ; assertFalse ( result . contains ( "\"withView2\":\"with\"" ) ) ; assertTrue ( result . contains ( "\"withoutView\":\"without\"" ) ) ; } public static class MyBean { private String string ; private int number ; private float fraction ; private String [ ] array ; private boolean bool ; private byte [ ] bytes ; public byte [ ] getBytes ( ) { } public void setBytes ( byte [ ] bytes ) { } public boolean isBool ( ) { } public void setBool ( boolean bool ) { } public String getString ( ) { } public void setString ( String string ) { } public int getNumber ( ) { } public void setNumber ( int number ) { } public float getFraction ( ) { } public void setFraction ( float fraction ) { } public String [ ] getArray ( ) { } public void setArray ( String [ ] array ) { } } public static class PrettyPrintBean { private String name ; public String getName ( ) { } public void setName ( String name ) { } } private interface MyJacksonView1 { } private interface MyJacksonView2 { } private static class JacksonViewBean { @ JsonView ( MappingJackson2HttpMessageConverterTests . MyJacksonView1 . class ) private String withView1 ; @ JsonView ( MappingJackson2HttpMessageConverterTests . MyJacksonView2 . class ) private String withView2 ; private String withoutView ; public String getWithView1 ( ) { } public void setWithView1 ( String withView1 ) { } public String getWithView2 ( ) { } public void setWithView2 ( String withView2 ) { } public String getWithoutView ( ) { } public void setWithoutView ( String withoutView ) { } } }

Fix:
MappingJacksonValue jsv = new MappingJacksonValue ( bean , MappingJackson2HttpMessageConverterTests . MyJacksonView1 . class ) ;