Class TestSupport

  • Direct Known Subclasses:
    CamelTestSupport

    @Deprecated
    public abstract class TestSupport
    extends org.junit.Assert
    Deprecated.
    A bunch of useful testing methods
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.slf4j.Logger log
      Deprecated.
       
      protected static String LS
      Deprecated.
       
    • Constructor Summary

      Constructors 
      Constructor Description
      TestSupport()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static <T> Collection<T> assertCollectionSize​(String message, Collection<T> list, int size)
      Deprecated.
      Asserts that a list is of the given size
      static <T> Collection<T> assertCollectionSize​(Collection<T> list, int size)
      Deprecated.
      Asserts that a list is of the given size
      static void assertDirectoryEquals​(String expected, String actual)
      Deprecated.
      To be used for folder/directory comparison that works across different platforms such as Window, Mac and Linux.
      static void assertDirectoryEquals​(String message, String expected, String actual)
      Deprecated.
      To be used for folder/directory comparison that works across different platforms such as Window, Mac and Linux.
      static void assertDirectoryExists​(String filename)
      Deprecated.
      To be used to check is a directory is found in the file system
      static void assertEndpointUri​(org.apache.camel.Endpoint endpoint, String uri)
      Deprecated.
       
      static Object assertExpression​(org.apache.camel.Expression expression, org.apache.camel.Exchange exchange, Object expected)
      Deprecated.
      Asserts that the given expression when evaluated returns the given answer
      static void assertFileExists​(String filename)
      Deprecated.
      To be used to check is a file is found in the file system
      static void assertFileNotExists​(String filename)
      Deprecated.
      To be used to check is a file is not found in the file system
      static void assertInMessageBodyEquals​(org.apache.camel.Exchange exchange, Object expected)
      Deprecated.
      Asserts that the given exchange has an OUT message of the given body value
      static Object assertInMessageHeader​(org.apache.camel.Exchange exchange, String name, Object expected)
      Deprecated.
      Asserts the In message on the exchange contains the expected value
      static <T> T assertIsInstanceOf​(Class<T> expectedType, Object value)
      Deprecated.
       
      static <T> List<T> assertListSize​(String message, List<T> list, int size)
      Deprecated.
      Asserts that a list is of the given size
      static <T> List<T> assertListSize​(List<T> list, int size)
      Deprecated.
      Asserts that a list is of the given size
      static Object assertMessageHeader​(org.apache.camel.Message message, String name, Object expected)
      Deprecated.
       
      static <T> T assertOneElement​(List<T> list)
      Deprecated.
       
      static void assertOutMessageBodyEquals​(org.apache.camel.Exchange exchange, Object expected)
      Deprecated.
      Asserts that the given exchange has an OUT message of the given body value
      static Object assertOutMessageHeader​(org.apache.camel.Exchange exchange, String name, Object expected)
      Deprecated.
      Asserts the Out message on the exchange contains the expected value
      static boolean assertPredicate​(org.apache.camel.Predicate predicate, org.apache.camel.Exchange exchange, boolean expected)
      Deprecated.
      Asserts that the predicate returns the expected value on the exchange
      static void assertPredicateDoesNotMatch​(org.apache.camel.Predicate predicate, org.apache.camel.Exchange exchange)
      Deprecated.
      Asserts that the predicate returns the expected value on the exchange
      static void assertPredicateMatches​(org.apache.camel.Predicate predicate, org.apache.camel.Exchange exchange)
      Deprecated.
      Asserts that the predicate returns the expected value on the exchange
      static void assertStringContains​(String text, String containedText)
      Deprecated.
      Asserts that the text contains the given string
      static org.apache.camel.builder.ValueBuilder body()
      Deprecated.
      Returns a predicate and value builder for the inbound body on an exchange
      static <T> org.apache.camel.builder.ValueBuilder bodyAs​(Class<T> type)
      Deprecated.
      Returns a predicate and value builder for the inbound message body as a specific type
      static void createDirectory​(String file)
      Deprecated.
      create the directory
      protected org.apache.camel.Exchange createExchangeWithBody​(org.apache.camel.CamelContext camelContext, Object body)
      Deprecated.
      Creates an exchange with the given body
      static boolean deleteDirectory​(File file)
      Deprecated.
      Recursively delete a directory, useful to zapping test data
      static boolean deleteDirectory​(String file)
      Deprecated.
      Recursively delete a directory, useful to zapping test data
      static org.apache.camel.builder.ValueBuilder exchangeProperty​(String name)
      Deprecated.
      Returns a value builder for the given exchange property
      static int getJavaMajorVersion()
      Deprecated.
      Returns the current major Java version e.g 8.
      static List<org.apache.camel.Route> getRouteList​(org.apache.camel.builder.RouteBuilder builder)
      Deprecated.
      A helper method to create a list of Route objects for a given route builder
      String getTestMethodName()
      Deprecated.
      Gets the current test method name
      org.junit.rules.TestName getTestName()
      Deprecated.
      Gets the current test name
      static org.apache.camel.builder.ValueBuilder header​(String name)
      Deprecated.
      Returns a value builder for the given header
      static boolean isJava15()
      Deprecated.
      will be removed in the future as Camel requires JDK1.8+
      static boolean isJava16()
      Deprecated.
      will be removed in the future as Camel requires JDK1.8+
      static boolean isJava17()
      Deprecated.
      will be removed in the future as Camel requires JDK1.8+
      static boolean isJava18()
      Deprecated.
      Is this Java 1.8
      static boolean isJava19()
      Deprecated.
      Is this Java 1.9
      static boolean isJavaVendor​(String vendor)
      Deprecated.
      Is this Java by the given vendor.
      static boolean isPlatform​(String platform)
      Deprecated.
      Is this OS the given platform.
      static org.apache.camel.builder.ValueBuilder property​(String name)
      Deprecated.
      static org.apache.camel.Endpoint resolveMandatoryEndpoint​(org.apache.camel.CamelContext context, String uri)
      Deprecated.
      Resolves an endpoint and asserts that it is found
      static <T extends org.apache.camel.Endpoint>
      T
      resolveMandatoryEndpoint​(org.apache.camel.CamelContext context, String uri, Class<T> endpointType)
      Deprecated.
      Resolves an endpoint and asserts that it is found
      static org.apache.camel.builder.ValueBuilder systemProperty​(String name)
      Deprecated.
      Returns a value builder for the given system property
      static org.apache.camel.builder.ValueBuilder systemProperty​(String name, String defaultValue)
      Deprecated.
      Returns a value builder for the given system property
      • Methods inherited from class org.junit.Assert

        assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertThrows, assertThrows, assertTrue, assertTrue, fail, fail
    • Field Detail

      • LS

        protected static final String LS
        Deprecated.
      • log

        protected org.slf4j.Logger log
        Deprecated.
    • Constructor Detail

      • TestSupport

        public TestSupport()
        Deprecated.
    • Method Detail

      • header

        public static org.apache.camel.builder.ValueBuilder header​(String name)
        Deprecated.
        Returns a value builder for the given header
      • exchangeProperty

        public static org.apache.camel.builder.ValueBuilder exchangeProperty​(String name)
        Deprecated.
        Returns a value builder for the given exchange property
      • body

        public static org.apache.camel.builder.ValueBuilder body()
        Deprecated.
        Returns a predicate and value builder for the inbound body on an exchange
      • bodyAs

        public static <T> org.apache.camel.builder.ValueBuilder bodyAs​(Class<T> type)
        Deprecated.
        Returns a predicate and value builder for the inbound message body as a specific type
      • systemProperty

        public static org.apache.camel.builder.ValueBuilder systemProperty​(String name)
        Deprecated.
        Returns a value builder for the given system property
      • systemProperty

        public static org.apache.camel.builder.ValueBuilder systemProperty​(String name,
                                                                           String defaultValue)
        Deprecated.
        Returns a value builder for the given system property
      • assertIsInstanceOf

        public static <T> T assertIsInstanceOf​(Class<T> expectedType,
                                               Object value)
        Deprecated.
      • assertEndpointUri

        public static void assertEndpointUri​(org.apache.camel.Endpoint endpoint,
                                             String uri)
        Deprecated.
      • assertInMessageHeader

        public static Object assertInMessageHeader​(org.apache.camel.Exchange exchange,
                                                   String name,
                                                   Object expected)
        Deprecated.
        Asserts the In message on the exchange contains the expected value
      • assertOutMessageHeader

        public static Object assertOutMessageHeader​(org.apache.camel.Exchange exchange,
                                                    String name,
                                                    Object expected)
        Deprecated.
        Asserts the Out message on the exchange contains the expected value
      • assertInMessageBodyEquals

        public static void assertInMessageBodyEquals​(org.apache.camel.Exchange exchange,
                                                     Object expected)
                                              throws org.apache.camel.InvalidPayloadException
        Deprecated.
        Asserts that the given exchange has an OUT message of the given body value
        Parameters:
        exchange - the exchange which should have an OUT message
        expected - the expected value of the OUT message
        Throws:
        org.apache.camel.InvalidPayloadException - is thrown if the payload is not the expected class type
      • assertOutMessageBodyEquals

        public static void assertOutMessageBodyEquals​(org.apache.camel.Exchange exchange,
                                                      Object expected)
                                               throws org.apache.camel.InvalidPayloadException
        Deprecated.
        Asserts that the given exchange has an OUT message of the given body value
        Parameters:
        exchange - the exchange which should have an OUT message
        expected - the expected value of the OUT message
        Throws:
        org.apache.camel.InvalidPayloadException - is thrown if the payload is not the expected class type
      • assertMessageHeader

        public static Object assertMessageHeader​(org.apache.camel.Message message,
                                                 String name,
                                                 Object expected)
        Deprecated.
      • assertExpression

        public static Object assertExpression​(org.apache.camel.Expression expression,
                                              org.apache.camel.Exchange exchange,
                                              Object expected)
        Deprecated.
        Asserts that the given expression when evaluated returns the given answer
      • assertPredicateMatches

        public static void assertPredicateMatches​(org.apache.camel.Predicate predicate,
                                                  org.apache.camel.Exchange exchange)
        Deprecated.
        Asserts that the predicate returns the expected value on the exchange
      • assertPredicateDoesNotMatch

        public static void assertPredicateDoesNotMatch​(org.apache.camel.Predicate predicate,
                                                       org.apache.camel.Exchange exchange)
        Deprecated.
        Asserts that the predicate returns the expected value on the exchange
      • assertPredicate

        public static boolean assertPredicate​(org.apache.camel.Predicate predicate,
                                              org.apache.camel.Exchange exchange,
                                              boolean expected)
        Deprecated.
        Asserts that the predicate returns the expected value on the exchange
      • resolveMandatoryEndpoint

        public static org.apache.camel.Endpoint resolveMandatoryEndpoint​(org.apache.camel.CamelContext context,
                                                                         String uri)
        Deprecated.
        Resolves an endpoint and asserts that it is found
      • resolveMandatoryEndpoint

        public static <T extends org.apache.camel.Endpoint> T resolveMandatoryEndpoint​(org.apache.camel.CamelContext context,
                                                                                       String uri,
                                                                                       Class<T> endpointType)
        Deprecated.
        Resolves an endpoint and asserts that it is found
      • createExchangeWithBody

        protected org.apache.camel.Exchange createExchangeWithBody​(org.apache.camel.CamelContext camelContext,
                                                                   Object body)
        Deprecated.
        Creates an exchange with the given body
      • assertOneElement

        public static <T> T assertOneElement​(List<T> list)
        Deprecated.
      • assertListSize

        public static <T> List<T> assertListSize​(List<T> list,
                                                 int size)
        Deprecated.
        Asserts that a list is of the given size
      • assertListSize

        public static <T> List<T> assertListSize​(String message,
                                                 List<T> list,
                                                 int size)
        Deprecated.
        Asserts that a list is of the given size
      • assertCollectionSize

        public static <T> Collection<T> assertCollectionSize​(Collection<T> list,
                                                             int size)
        Deprecated.
        Asserts that a list is of the given size
      • assertCollectionSize

        public static <T> Collection<T> assertCollectionSize​(String message,
                                                             Collection<T> list,
                                                             int size)
        Deprecated.
        Asserts that a list is of the given size
      • getRouteList

        public static List<org.apache.camel.Route> getRouteList​(org.apache.camel.builder.RouteBuilder builder)
                                                         throws Exception
        Deprecated.
        A helper method to create a list of Route objects for a given route builder
        Throws:
        Exception
      • assertStringContains

        public static void assertStringContains​(String text,
                                                String containedText)
        Deprecated.
        Asserts that the text contains the given string
        Parameters:
        text - the text to compare
        containedText - the text which must be contained inside the other text parameter
      • deleteDirectory

        public static boolean deleteDirectory​(String file)
        Deprecated.
        Recursively delete a directory, useful to zapping test data
        Parameters:
        file - the directory to be deleted
        Returns:
        false if error deleting directory
      • deleteDirectory

        public static boolean deleteDirectory​(File file)
        Deprecated.
        Recursively delete a directory, useful to zapping test data
        Parameters:
        file - the directory to be deleted
        Returns:
        false if error deleting directory
      • createDirectory

        public static void createDirectory​(String file)
        Deprecated.
        create the directory
        Parameters:
        file - the directory to be created
      • assertDirectoryEquals

        public static void assertDirectoryEquals​(String expected,
                                                 String actual)
        Deprecated.
        To be used for folder/directory comparison that works across different platforms such as Window, Mac and Linux.
      • assertDirectoryEquals

        public static void assertDirectoryEquals​(String message,
                                                 String expected,
                                                 String actual)
        Deprecated.
        To be used for folder/directory comparison that works across different platforms such as Window, Mac and Linux.
      • assertDirectoryExists

        public static void assertDirectoryExists​(String filename)
        Deprecated.
        To be used to check is a directory is found in the file system
      • assertFileExists

        public static void assertFileExists​(String filename)
        Deprecated.
        To be used to check is a file is found in the file system
      • assertFileNotExists

        public static void assertFileNotExists​(String filename)
        Deprecated.
        To be used to check is a file is not found in the file system
      • isPlatform

        public static boolean isPlatform​(String platform)
        Deprecated.
        Is this OS the given platform.

        Uses os.name from the system properties to determine the OS.

        Parameters:
        platform - such as Windows
        Returns:
        true if its that platform.
      • isJavaVendor

        public static boolean isJavaVendor​(String vendor)
        Deprecated.
        Is this Java by the given vendor.

        Uses java.vendor from the system properties to determine the vendor.

        Parameters:
        vendor - such as IBM
        Returns:
        true if its that vendor.
      • isJava15

        @Deprecated
        public static boolean isJava15()
        Deprecated.
        will be removed in the future as Camel requires JDK1.8+
        Is this Java 1.5
        Returns:
        true if its Java 1.5, false if its not (for example Java 1.6 or better)
      • isJava16

        @Deprecated
        public static boolean isJava16()
        Deprecated.
        will be removed in the future as Camel requires JDK1.8+
        Is this Java 1.6
        Returns:
        true if its Java 1.6, false if its not (for example Java 1.7 or better)
      • isJava17

        @Deprecated
        public static boolean isJava17()
        Deprecated.
        will be removed in the future as Camel requires JDK1.8+
        Is this Java 1.7
        Returns:
        true if its Java 1.7, false if its not (for example Java 1.6 or older)
      • isJava18

        public static boolean isJava18()
        Deprecated.
        Is this Java 1.8
        Returns:
        true if its Java 1.8, false if its not (for example Java 1.7 or older)
      • isJava19

        public static boolean isJava19()
        Deprecated.
        Is this Java 1.9
        Returns:
        true if its Java 1.9, false if its not (for example Java 1.8 or older)
      • getJavaMajorVersion

        public static int getJavaMajorVersion()
        Deprecated.
        Returns the current major Java version e.g 8.

        Uses java.specification.version from the system properties to determine the major version.

        Returns:
        the current major Java version.
      • getTestName

        public org.junit.rules.TestName getTestName()
        Deprecated.
        Gets the current test name
        Returns:
        the test name
      • getTestMethodName

        public String getTestMethodName()
        Deprecated.
        Gets the current test method name
        Returns:
        the method name