DefaultValueFormatter implements ValueFormatter<Object> { @Override public String format(Object value) { if (value instanceof Enum) { return enumFormatter.format((Enum<?>) value); } else if (value instanceof HasUuid) { HasUuid uuidObject = (HasUuid) value; return uuidObject.getUuid(); } else { return Objects.toString(value, SimpleValueContainer.DEFAULT_NULL_STRING); } }  @Override String format(Object value);  }
@Test public void shouldFormatEnums() { DefaultValueFormatter cut = new DefaultValueFormatter(); assertThat(cut.format(Month.MAY), is(equalTo("MAY"))); }
@Test public void shouldFormatHasUuid() { DefaultValueFormatter cut = new DefaultValueFormatter(); final String theUuid = "the-uuid"; SimpleBooleanFlagEntity e = new SimpleBooleanFlagEntity(theUuid, false); assertThat(cut.format(e), is(equalTo(theUuid))); }
@Test public void shouldFormatObjects() { DefaultValueFormatter cut = new DefaultValueFormatter(); assertThat(cut.format(Boolean.FALSE), is(equalTo("false"))); }
@Test public void shouldFormatNull() { DefaultValueFormatter cut = new DefaultValueFormatter(); assertThat(cut.format(null), is(equalTo(SimpleValueContainer.DEFAULT_NULL_STRING))); }