Class AbstractSerializingTestCase<T extends ToXContent & Writeable>

    • Constructor Detail

      • AbstractSerializingTestCase

        public AbstractSerializingTestCase()
    • Method Detail

      • testFromXContent

        public final void testFromXContent()
                                    throws java.io.IOException
        Generic test that creates new instance from the test instance and checks both for equality and asserts equality on the two instances.
        Throws:
        java.io.IOException
      • doParseInstance

        protected abstract T doParseInstance​(XContentParser parser)
                                      throws java.io.IOException
        Parses to a new instance using the provided XContentParser
        Throws:
        java.io.IOException
      • supportsUnknownFields

        protected boolean supportsUnknownFields()
        Indicates whether the parser supports unknown fields or not. In case it does, such behaviour will be tested by inserting random fields before parsing and checking that they don't make parsing fail.
      • getRandomFieldsExcludeFilter

        protected java.util.function.Predicate<java.lang.String> getRandomFieldsExcludeFilter()
        Returns a predicate that given the field name indicates whether the field has to be excluded from random fields insertion or not
      • getShuffleFieldsExceptions

        protected java.lang.String[] getShuffleFieldsExceptions()
        Fields that have to be ignored when shuffling as part of testFromXContent
      • assertToXContentEquivalence

        protected boolean assertToXContentEquivalence()
        Whether or not to assert equivalence of the XContent of the test instance and the instance parsed from the XContent of the test instance.
        Returns:
        true if equivalence should be asserted, otherwise false