Class ActualValueInference

java.lang.Object
com.google.common.truth.ActualValueInference

final class ActualValueInference extends Object
Given the stack frame of a failing assertion, tries to describe what the user passed to assertThat.

For example, suppose that the test contains:


 assertThat(logService.fetchLogMessages(startDate, endDate))
     .containsExactly(message1, message2)
     .inOrder();
 
If either containsExactly or inOrder fails, ActualValueInference reports (if the rest of the test method is simple enough to analyze easily) that the user passed fetchLogMessages(...). This allows us to produce a failure message like:
 value of   : fetchLogMessages(...)
 missing (1): message1
 ...
 
ActualValueInference accomplishes this by examining the bytecode of the test. Naturally, this is all best-effort.