@Test public void usesToStringFormatterToFormatTheToStringInfo() { when(toStringFormatter.format(any())).thenReturn("Formatted String"); final String stringValue = formattedStringGenerator.format(new SimpleObject()); assertThat(stringValue, is("Formatted String")); }
@Test public void usesInfoCompilerToCompileValuesFromObjectAndTypeInfo() { final TypeInfo typeInfo = mock(TypeInfo.class); when(typeInfoCache.typeInfoFor(any())).thenReturn(typeInfo); SimpleObject object = new SimpleObject(); formattedStringGenerator.format(object); verify(objectValuesCompiler).compileToStringInfo(typeInfo, object); }
@Test public void retrievesTypeInformationFromTypeInfoCacheWhenGeneratingToString() { formattedStringGenerator.format(new SimpleObject()); verify(typeInfoCache).typeInfoFor(SimpleObject.class); }