org.unitils.mock.report.impl
Class DetailedObservedInvocationsReport

java.lang.Object
  extended by org.unitils.mock.report.impl.ProxyInvocationsReport
      extended by org.unitils.mock.report.impl.ObservedInvocationsReport
          extended by org.unitils.mock.report.impl.DetailedObservedInvocationsReport

public class DetailedObservedInvocationsReport
extends ObservedInvocationsReport

A view that displays the details of the observed invocations. The details include:

Example:

 1. mock.method1() -> string1

 - string1 -> "1234567891234567890"
 - Observed at MyTest.testMethod(MyTest.java:75)
 - Behavior defined at MyTest.myTest(MyTest.java:37)


 2. mock.method1("value", 4) -> null

 - Observed at MyTest.testMethod(MyTest.java:77)
 - No behavior defined, returned default value.
 

Author:
Kenny Claes, Filip Neven, Tim Ducheyne

Nested Class Summary
 
Nested classes/interfaces inherited from class org.unitils.mock.report.impl.ProxyInvocationsReport
ProxyInvocationsReport.FormattedObject
 
Field Summary
 
Fields inherited from class org.unitils.mock.report.impl.ProxyInvocationsReport
MAX_INLINE_PARAMETER_LENGTH, OBJECT_FORMATTER_MAX_NR_ARRAY_OR_COLLECTION_ELEMENTS, OBJECT_FORMATTER_MAX_RECURSION_DEPT, objectFormatter, testedObjectFieldValuesAndNames
 
Constructor Summary
DetailedObservedInvocationsReport(Object testedObject)
           
 
Method Summary
 String createReport(List<ObservedInvocation> observedInvocations)
          Creates a string representation of the given scenario as described in the class javadoc.
protected  String formatBehaviorDetails(ObservedInvocation observedInvocation)
          Creates a string representation of the behavior details of the given invocation.
protected  String formatInvokedAt(ProxyInvocation proxyInvocation)
          Creates a string representation of the details of the given invocation.
protected  String formatLargeObjects(List<ProxyInvocationsReport.FormattedObject> largeObjects)
          Format the values that were to long to be displayed inline
 
Methods inherited from class org.unitils.mock.report.impl.ObservedInvocationsReport
formatMockName, formatObservedInvocation
 
Methods inherited from class org.unitils.mock.report.impl.ProxyInvocationsReport
createLargeValueName, formatInvocationIndex, formatObject, formatValue, getFieldValuesAndNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DetailedObservedInvocationsReport

public DetailedObservedInvocationsReport(Object testedObject)
Method Detail

createReport

public String createReport(List<ObservedInvocation> observedInvocations)
Creates a string representation of the given scenario as described in the class javadoc.

Overrides:
createReport in class ObservedInvocationsReport
Parameters:
observedInvocations - The invocations for which to create a report, not null
Returns:
The string representation, not null

formatInvokedAt

protected String formatInvokedAt(ProxyInvocation proxyInvocation)
Creates a string representation of the details of the given invocation. This will give information about where the invocation occurred.

Overrides:
formatInvokedAt in class ProxyInvocationsReport
Parameters:
proxyInvocation - The invocation to format, not null
Returns:
The string representation, not null

formatBehaviorDetails

protected String formatBehaviorDetails(ObservedInvocation observedInvocation)
Creates a string representation of the behavior details of the given invocation. This will give information about where the mock behavior was recorded.

Parameters:
observedInvocation - The invocation to format, not null
Returns:
The string representation, not null

formatLargeObjects

protected String formatLargeObjects(List<ProxyInvocationsReport.FormattedObject> largeObjects)
Format the values that were to long to be displayed inline

Parameters:
largeObjects - The large value representations, not null
Returns:
The string representation, not null


Copyright © 2011. All Rights Reserved.