Class BrowserTest


  • public abstract class BrowserTest
    extends ConnectorTest
    Base test class for testing browse operations with ConnectorTester. Implementing classes will execute all defined tests.
    • Constructor Detail

      • BrowserTest

        public BrowserTest​(String label,
                           String id,
                           String expectedElementName,
                           EnumSet<OperationType> expectedOperations)
        Creates a new test instance.

        Intended to be used as part of a Parameterized test but can be run as a single test instance by invoking this constructor from the no argument constructor of the implementing class.

        Parameters:
        label - the label for the expected ObjectType
        id - the id for the expected ObjectType
        expectedElementName - the expected name of the element in the profile ObjectDefinition
        expectedOperations - the expected OperationType values supported for this object
    • Method Detail

      • getObjectTypes

        public final void getObjectTypes()
        Setup method for browser tests

        This method will perform the browse for all operations and cache the response so that it does not need to be performed for each object under test.

      • testBrowseTypesForGetOperation

        public final void testBrowseTypesForGetOperation()
        Test method to verify if the current object supports the OperationType.GET operation
      • testBrowseTypesForQueryOperation

        public final void testBrowseTypesForQueryOperation()
        Test method to verify if the current object supports the OperationType.QUERY operation
      • testBrowseTypesForUpdateOperation

        public final void testBrowseTypesForUpdateOperation()
        Test method to verify if the current object supports the OperationType.UPDATE operation
      • testBrowseTypesForUpsertOperation

        public final void testBrowseTypesForUpsertOperation()
        Test method to verify if the current object supports the OperationType.UPSERT operation
      • testBrowseTypesForCreateOperation

        public final void testBrowseTypesForCreateOperation()
        Test method to verify if the current object supports the OperationType.CREATE operation
      • testBrowseTypesForDeleteOperation

        public final void testBrowseTypesForDeleteOperation()
        Test method to verify if the current object supports the OperationType.DELETE operation
      • testBrowseTypesForExecuteOperation

        public final void testBrowseTypesForExecuteOperation()
        Test method to verify if the current object supports the OperationType.EXECUTE operation
      • testBrowseProfile

        public final void testBrowseProfile()
                                     throws Exception
        Test method to verify the profile for current object

        Base verifications include verifying that a definition exists for the expected element and that definition has a schema defined. The test will use the expected operation with the most supported roles.

        Throws:
        Exception - exception browsing profile
      • clearBrowseCache

        protected static void clearBrowseCache()
        This method can be used to clear the browse cache.Used in scenarios when testing object browse on different api version where different versions support different objects on same operation. Use @BeforeClass in a test
      • afterTestBrowseProfile

        protected void afterTestBrowseProfile​(ObjectDefinitions objectDefinitions)
                                       throws Exception
        This method can be overridden to provide additional verification beyond the base verifications performed by testBrowseProfile(). This method will only execute after other verifications have passed.
        Parameters:
        objectDefinitions - object definitions instance created by testBrowseProfile()
        Throws:
        Exception - exception validating the object definitions
      • getObjectDefinitions

        protected ObjectDefinitions getObjectDefinitions​(OperationType operationType)
        A convenience method to get profile definitions for the requested operation type
      • isStrict

        protected boolean isStrict()
        This method can be overridden to enable strict verification of the browse types test.

        If this method overridden to return true, then getExpectedObjectCount(OperationType) must also be overridden as it is used to determine the expected number of object types for each operation.

        Returns:
        boolean indicating if the number of object types should be verified for each operation
      • getExpectedObjectCount

        protected int getExpectedObjectCount​(OperationType operationType)
        This method must be overridden to return the expected number of object types for the specified operation if isStrict() has been overridden to return true.
        Parameters:
        operationType - OperationType under test
        Returns:
        the expected number of object types for the specified operation