### Question:
Payload { @Nonnull @Override public String toString() { final StringBuilder s = new StringBuilder(50).append('{'); if (map != null) { s.append(" map : ["); for (final Map.Entry<String, Object> entry : map.entrySet()) { s.append('(').append(entry.getKey()).append(',').append(entry.getValue()).append(')'); } s.append(']'); } if (doubleValue != null) { s.append(" doubleValue : ").append(doubleValue); } if (doubleArray != null) { s.append(" doubleArray : ["); s.append(StringUtils.join(doubleArray, ", ")); s.append(']'); } if (longValue != null) { s.append(" longValue : ").append(longValue); } if (longArray != null) { s.append(" longArray : ["); s.append(StringUtils.join(longArray, ", ")); s.append(']'); } if (stringValue != null) { s.append(" stringValue : \"").append(stringValue).append('"'); } if (stringArray != null) { s.append(" stringArray : ["); if (stringArray.length > 0) { s.append('"'); s.append(String.join("\", \"", stringArray)); s.append('"'); } s.append(']'); } s.append(" }"); return s.toString(); } Payload(final String value);  Payload(final Double value);  Payload(final Long value);  Payload(final Map<String, Object> value);  Payload(final String[] values);  Payload(final Double[] values);  Payload(final Long[] values);  Payload();  Payload(@Nonnull final Payload other); @Nullable Double getDoubleValue(); void setDoubleValue(@Nullable final Double doubleValue); @Nullable Double[] getDoubleArray(); void setDoubleArray(@Nullable final Double[] doubleArray); @Nullable Long getLongValue(); void setLongValue(@Nullable final Long longValue); @Nullable Long[] getLongArray(); void setLongArray(@Nullable final Long[] longArray); @Nullable String getStringValue(); void setStringValue(@Nullable final String stringValue); @Nullable String[] getStringArray(); void setStringArray(@Nullable final String[] stringArray); @Nullable Map<String, Object> getMap(); void setMap(@Nullable final Map<String, Object> map); @Nonnull @Override String toString(); @Nonnull Optional<PayloadType> fetchPayloadType(); static boolean hasType(final Payload payload, final PayloadType payloadType); @Nonnull @Deprecated String fetchType(); boolean sameType(@Nullable final Payload other); int numFieldsDefined(); @CheckForNull Object fetchAValue(); @Override boolean equals(final Object o); @Override int hashCode(); static final Payload EMPTY_PAYLOAD; static final String PAYLOAD_OVERWRITE_EXCEPTION; }### Answer:
@Test public void testPayloadToString() { final Map<PayloadType, Payload> payloads = getPayloadTypePayloadSampleMap(0); assertThat(payloads.get(PayloadType.DOUBLE_VALUE).toString()) .contains("doubleValue") .contains("47"); assertThat(payloads.get(PayloadType.DOUBLE_ARRAY).toString()) .contains("doubleArray") .contains("98") .contains("-137"); assertThat(payloads.get(PayloadType.LONG_VALUE).toString()) .contains("longValue") .contains("42"); assertThat(payloads.get(PayloadType.LONG_ARRAY).toString()) .contains("longArray") .contains("9,") .contains("8,") .contains("7,") .contains("6,") .contains("5,") .contains("4"); assertThat(payloads.get(PayloadType.STRING_VALUE).toString()) .contains("stringValue") .contains("foobar"); assertThat(payloads.get(PayloadType.STRING_ARRAY).toString()) .contains("stringArray") .contains("foo") .contains("bar") .contains("baz"); }