@Test
public void serializeAsFieldDoesNotWritePropertiesIfPropertiesExcludedByFilters() throws Exception {

    // given
    VirtualProperty virtualProperty = mock(VirtualProperty.class);
    ValueResolver valueResolver = mock(ValueResolver.class);
    VirtualPropertyFilter virtualPropertyFilter = mock(VirtualPropertyFilter.class);
    when(virtualPropertyFilter.isIncluded(any(), any())).thenReturn(false);
    VirtualPropertiesWriter writer = new VirtualPropertiesWriter(
            new VirtualProperty[] { virtualProperty },
            valueResolver,
            new VirtualPropertyFilter[] { virtualPropertyFilter }
    );
    JsonGenerator jsonGenerator = mock(JsonGenerator.class);
    // when
    writer.serializeAsField(new Object(), jsonGenerator, mock(SerializerProvider.class));
    // then
    verify(jsonGenerator, never()).writeFieldName(anyString());
    verify(jsonGenerator, never()).writeString(anyString());
    verify(jsonGenerator, never()).writeString(eq((String)null));
}