@Test public void emptyMdcAndArguments() { StringBuilder sb = new StringBuilder(); converter.convert(sb, Collections.emptyMap()); assertThat(sb, hasToString("")); }
public void convert(StringBuilder appendTo, Map<String, String> mdcPropertiesMap, Object... arguments) { if (customFieldKeyNames.isEmpty()) { return; } Map<String, CustomField> customFields = getRegisteredCustomFields(arguments); Map<String, String> mdcCustomFields = getRegisteredMdcCustomFields(mdcPropertiesMap); if (!customFields.isEmpty() || !mdcCustomFields.isEmpty()) { try { ArrayComposer<ObjectComposer<JSONComposer<String>>> oc = startJson(appendTo); addCustomFields(oc, customFields, mdcCustomFields); finishJson(oc, appendTo); } catch (Exception ex) { LoggerFactory.getLogger(DefaultCustomFieldsConverter.class).error("Conversion failed ", ex); } } }
DefaultCustomFieldsConverter { public void convert(StringBuilder appendTo, Map<String, String> mdcPropertiesMap, Object... arguments) { if (customFieldKeyNames.isEmpty()) { return; } Map<String, CustomField> customFields = getRegisteredCustomFields(arguments); Map<String, String> mdcCustomFields = getRegisteredMdcCustomFields(mdcPropertiesMap); if (!customFields.isEmpty() || !mdcCustomFields.isEmpty()) { try { ArrayComposer<ObjectComposer<JSONComposer<String>>> oc = startJson(appendTo); addCustomFields(oc, customFields, mdcCustomFields); finishJson(oc, appendTo); } catch (Exception ex) { LoggerFactory.getLogger(DefaultCustomFieldsConverter.class).error("Conversion failed ", ex); } } } }
DefaultCustomFieldsConverter { public void convert(StringBuilder appendTo, Map<String, String> mdcPropertiesMap, Object... arguments) { if (customFieldKeyNames.isEmpty()) { return; } Map<String, CustomField> customFields = getRegisteredCustomFields(arguments); Map<String, String> mdcCustomFields = getRegisteredMdcCustomFields(mdcPropertiesMap); if (!customFields.isEmpty() || !mdcCustomFields.isEmpty()) { try { ArrayComposer<ObjectComposer<JSONComposer<String>>> oc = startJson(appendTo); addCustomFields(oc, customFields, mdcCustomFields); finishJson(oc, appendTo); } catch (Exception ex) { LoggerFactory.getLogger(DefaultCustomFieldsConverter.class).error("Conversion failed ", ex); } } }  }
DefaultCustomFieldsConverter { public void convert(StringBuilder appendTo, Map<String, String> mdcPropertiesMap, Object... arguments) { if (customFieldKeyNames.isEmpty()) { return; } Map<String, CustomField> customFields = getRegisteredCustomFields(arguments); Map<String, String> mdcCustomFields = getRegisteredMdcCustomFields(mdcPropertiesMap); if (!customFields.isEmpty() || !mdcCustomFields.isEmpty()) { try { ArrayComposer<ObjectComposer<JSONComposer<String>>> oc = startJson(appendTo); addCustomFields(oc, customFields, mdcCustomFields); finishJson(oc, appendTo); } catch (Exception ex) { LoggerFactory.getLogger(DefaultCustomFieldsConverter.class).error("Conversion failed ", ex); } } }  void setFieldName(String fieldName); void setCustomFieldKeyNames(List<String> customFieldKeyNames); void convert(StringBuilder appendTo, Map<String, String> mdcPropertiesMap, Object... arguments); }
DefaultCustomFieldsConverter { public void convert(StringBuilder appendTo, Map<String, String> mdcPropertiesMap, Object... arguments) { if (customFieldKeyNames.isEmpty()) { return; } Map<String, CustomField> customFields = getRegisteredCustomFields(arguments); Map<String, String> mdcCustomFields = getRegisteredMdcCustomFields(mdcPropertiesMap); if (!customFields.isEmpty() || !mdcCustomFields.isEmpty()) { try { ArrayComposer<ObjectComposer<JSONComposer<String>>> oc = startJson(appendTo); addCustomFields(oc, customFields, mdcCustomFields); finishJson(oc, appendTo); } catch (Exception ex) { LoggerFactory.getLogger(DefaultCustomFieldsConverter.class).error("Conversion failed ", ex); } } }  void setFieldName(String fieldName); void setCustomFieldKeyNames(List<String> customFieldKeyNames); void convert(StringBuilder appendTo, Map<String, String> mdcPropertiesMap, Object... arguments);  }