@Test
public void withConfigReturnsConfiguredWriter() {

    // given
    ObjectMapper objectMapper = new ObjectMapper();
    SerializationConfig config = objectMapper.getSerializationConfig();
    VirtualPropertiesWriter writer = spy(new VirtualPropertiesWriter(
            new VirtualProperty[0],
            mock(ValueResolver.class),
            new VirtualPropertyFilter[0]
    ));
    JavaType javaType = config.constructType(LogEvent.class);
    AnnotatedClass annotatedClass = createTestAnnotatedClass(config, javaType);
    SimpleBeanPropertyDefinition simpleBeanPropertyDefinition =
            getTestBeanPropertyDefinition(config, javaType, annotatedClass);
    VirtualPropertiesWriter result = writer.withConfig(
            config,
            annotatedClass,
            simpleBeanPropertyDefinition,
            config.constructType(VirtualProperty.class)
    );
    // then
    assertArrayEquals(writer.virtualProperties, result.virtualProperties);
    assertEquals(writer.valueResolver, result.valueResolver);
    assertEquals(writer.filters, result.filters);
}