Class ActualValueInference


  • final class ActualValueInference
    extends java.lang.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.
    • Field Detail

      • BORING_NAMES

        private static final com.google.common.collect.ImmutableSet<java.lang.String> BORING_NAMES
      • PRIMITIVE_WRAPPERS

        private static final com.google.common.collect.ImmutableSet<java.lang.String> PRIMITIVE_WRAPPERS
    • Constructor Detail

      • ActualValueInference

        private ActualValueInference()