public String formatMap(final Map<?, ?> map, final int currentDepth) {
        final StringBuilder result = new StringBuilder();
        result.append('{');
        int count = 0;
        for (final Map.Entry<?, ?> element : map.entrySet()) {
            if (count > 0) {
                result.append(", ");
            }
            count++;
            result.append(objectFormatter.format(element.getKey(), currentDepth));
            result.append('=');
            result.append(objectFormatter.format(element.getValue(), currentDepth + 1));

            if (count >= maxElements && count < map.size()) {
                result.append(DOTS);
                break;
            }
        }
        result.append('}');

        return result.toString();
    }