Class Platform


  • final class Platform
    extends java.lang.Object
    Extracted routines that need to be swapped in for GWT, to allow for minimal deltas between the GWT and non-GWT version.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Platform()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static void cleanStackTrace​(java.lang.Throwable throwable)  
      (package private) static boolean containsMatch​(java.lang.String actual, java.lang.String regex)
      Determines if the given subject contains a match for the given regex.
      (package private) static java.lang.String doubleToString​(double value)  
      (package private) static java.lang.String floatToString​(float value)  
      (package private) static java.lang.String getStackTraceAsString​(java.lang.Throwable throwable)
      Returns a human readable string representation of the throwable's stack trace.
      (package private) static java.lang.Throwable[] getSuppressed​(java.lang.Throwable throwable)
      Returns an array containing all of the exceptions that were suppressed to deliver the given exception.
      (package private) static java.lang.String inferDescription()
      Tries to infer a name for the root actual value from the bytecode.
      (package private) static boolean isAndroid()
      Tests if current platform is Android.
      private static boolean isInferDescriptionDisabled()  
      (package private) static boolean isInstanceOfType​(java.lang.Object instance, java.lang.Class<?> clazz)
      Returns true if the instance is assignable to the type Clazz.
      (package private) static com.google.common.collect.ImmutableList<Fact> makeDiff​(java.lang.String expected, java.lang.String actual)  
      private static com.google.common.collect.ImmutableList<java.lang.String> splitLines​(java.lang.String s)  
      • Methods inherited from class java.lang.Object

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

      • EXPECT_FAILURE_WARNING_IF_GWT

        static final java.lang.String EXPECT_FAILURE_WARNING_IF_GWT
        See Also:
        Constant Field Values
    • Constructor Detail

      • Platform

        private Platform()
    • Method Detail

      • isInstanceOfType

        static boolean isInstanceOfType​(java.lang.Object instance,
                                        java.lang.Class<?> clazz)
        Returns true if the instance is assignable to the type Clazz.
      • containsMatch

        static boolean containsMatch​(java.lang.String actual,
                                     java.lang.String regex)
        Determines if the given subject contains a match for the given regex.
      • getSuppressed

        static java.lang.Throwable[] getSuppressed​(java.lang.Throwable throwable)
        Returns an array containing all of the exceptions that were suppressed to deliver the given exception. If suppressed exceptions are not supported (pre-Java 1.7), an empty array will be returned.
      • cleanStackTrace

        static void cleanStackTrace​(java.lang.Throwable throwable)
      • inferDescription

        static java.lang.String inferDescription()
        Tries to infer a name for the root actual value from the bytecode. The "root" actual value is the value passed to assertThat or that, as distinct from any later actual values produced by chaining calls like hasMessageThat.
      • makeDiff

        static com.google.common.collect.ImmutableList<Fact> makeDiff​(java.lang.String expected,
                                                                      java.lang.String actual)
      • splitLines

        private static com.google.common.collect.ImmutableList<java.lang.String> splitLines​(java.lang.String s)
      • doubleToString

        static java.lang.String doubleToString​(double value)
      • floatToString

        static java.lang.String floatToString​(float value)
      • getStackTraceAsString

        static java.lang.String getStackTraceAsString​(java.lang.Throwable throwable)
        Returns a human readable string representation of the throwable's stack trace.
      • isAndroid

        static boolean isAndroid()
        Tests if current platform is Android.
      • isInferDescriptionDisabled

        private static boolean isInferDescriptionDisabled()