Package org.junit

Class ComparisonFailure.ComparisonCompactor

  • Enclosing class:
    ComparisonFailure

    private static class ComparisonFailure.ComparisonCompactor
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String actual  
      private int contextLength
      The maximum length for expected and actual strings to show.
      private static java.lang.String DIFF_END  
      private static java.lang.String DIFF_START  
      private static java.lang.String ELLIPSIS  
      private java.lang.String expected  
    • Constructor Summary

      Constructors 
      Constructor Description
      ComparisonCompactor​(int contextLength, java.lang.String expected, java.lang.String actual)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String compact​(java.lang.String message)  
      private java.lang.String sharedPrefix()  
      private java.lang.String sharedSuffix​(java.lang.String prefix)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • contextLength

        private final int contextLength
        The maximum length for expected and actual strings to show. When contextLength is exceeded, the Strings are shortened.
      • expected

        private final java.lang.String expected
      • actual

        private final java.lang.String actual
    • Constructor Detail

      • ComparisonCompactor

        public ComparisonCompactor​(int contextLength,
                                   java.lang.String expected,
                                   java.lang.String actual)
        Parameters:
        contextLength - the maximum length of context surrounding the difference between the compared strings. When context length is exceeded, the prefixes and suffixes are compacted.
        expected - the expected string value
        actual - the actual string value
    • Method Detail

      • compact

        public java.lang.String compact​(java.lang.String message)
      • sharedPrefix

        private java.lang.String sharedPrefix()
      • sharedSuffix

        private java.lang.String sharedSuffix​(java.lang.String prefix)