Class ClonerTester


  • public class ClonerTester
    extends Object
    • Method Detail

      • testCloning

        public static <T> void testCloning​(@Nullable
                                           @Nullable Function<? super T,​? super T> initialiser,
                                           @NotNull
                                           @NotNull Function<? super T,​? super T> cloner,
                                           @NotNull
                                           @NotNull Class<T> aClass)
        This method can be used to verify that your cloning function leaves no fields uninitialised in the clone.
        Parameters:
        initialiser - optional custom initialiser used to mock some funvtions to workaround Mockito bugs or cater for more complex cloners (e.g. recursive ones)
        cloner - the function capable of cloning your object
        aClass - the concrete class of the object to clone