Class AbstractWireTestCase<T>

    • Constructor Detail

      • AbstractWireTestCase

        public AbstractWireTestCase()
    • Method Detail

      • createTestInstance

        protected abstract T createTestInstance()
        Creates a random test instance to use in the tests. This method will be called multiple times during test execution and should return a different random instance each time it is called.
      • mutateInstance

        protected T mutateInstance​(T instance)
                            throws java.io.IOException
        Returns an instance which is mutated slightly so it should not be equal to the given instance.
        Throws:
        java.io.IOException
      • testEqualsAndHashcode

        public final void testEqualsAndHashcode()
        Tests that the equals and hashcode methods are consistent and copied versions of the instance have are equal.
      • testSerialization

        public final void testSerialization()
                                     throws java.io.IOException
        Test serialization and deserialization of the test instance.
        Throws:
        java.io.IOException
      • assertSerialization

        protected final T assertSerialization​(T testInstance)
                                       throws java.io.IOException
        Serialize the given instance and asserts that both are equal
        Throws:
        java.io.IOException
      • assertSerialization

        protected final T assertSerialization​(T testInstance,
                                              Version version)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • assertEqualInstances

        protected void assertEqualInstances​(T expectedInstance,
                                            T newInstance)
      • copyInstance

        protected final T copyInstance​(T instance)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • copyInstance

        protected abstract T copyInstance​(T instance,
                                          Version version)
                                   throws java.io.IOException
        Throws:
        java.io.IOException