Class TestProperty


  • public class TestProperty
    extends java.lang.Object
    provides different methods to test properties described as predicates. By default, if not specified the times parameter, every property is tested against 1000 generated values. The seed of the generation is generated if not provided. I recommend you generate the seed before the test and printing it out in case of failure.
    • Constructor Summary

      Constructors 
      Constructor Description
      TestProperty()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <O extends JsValue>
      void
      test​(JsGen<O> gen, java.util.function.Predicate<O> condition, int times, java.util.function.Consumer<O> errorConsumer)  
      static <O extends JsValue>
      void
      test​(JsGen<O> gen, java.util.function.Predicate<O> condition, int times, java.util.function.Consumer<O> errorConsumer, java.util.Random random)  
      static <O extends JsValue>
      void
      test​(JsGen<O> gen, java.util.function.Predicate<O> condition, java.util.function.Consumer<O> errorConsumer)  
      static <O extends JsValue>
      void
      test​(JsGen<O> gen, java.util.function.Predicate<O> condition, java.util.function.Consumer<O> errorConsumer, java.util.Random random)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestProperty

        public TestProperty()
    • Method Detail

      • test

        public static <O extends JsValue> void test​(JsGen<O> gen,
                                                    java.util.function.Predicate<O> condition,
                                                    java.util.function.Consumer<O> errorConsumer)
        Type Parameters:
        O - the type of the generated and tested value
        Parameters:
        gen - generator to produce randomized input data
        condition - the property to be tested
        errorConsumer - consumer that takes the value that made the test fail
      • test

        public static <O extends JsValue> void test​(JsGen<O> gen,
                                                    java.util.function.Predicate<O> condition,
                                                    int times,
                                                    java.util.function.Consumer<O> errorConsumer)
        Type Parameters:
        O - the type of the generated and tested value
        Parameters:
        gen - generator to produce randomized input data
        condition - the property to be tested
        times - number of times an input is produced and tested on the property
        errorConsumer - consumer that takes the value that made the test fail
      • test

        public static <O extends JsValue> void test​(JsGen<O> gen,
                                                    java.util.function.Predicate<O> condition,
                                                    int times,
                                                    java.util.function.Consumer<O> errorConsumer,
                                                    java.util.Random random)
        Type Parameters:
        O - the type of the generated and tested value
        Parameters:
        gen - generator to produce randomized input data
        condition - the property to be tested
        times - number of times an input is produced and tested on the property
        errorConsumer - consumer that takes the value that made the test fail
        random - the initial seed
      • test

        public static <O extends JsValue> void test​(JsGen<O> gen,
                                                    java.util.function.Predicate<O> condition,
                                                    java.util.function.Consumer<O> errorConsumer,
                                                    java.util.Random random)
        Type Parameters:
        O - the type of the generated and tested value
        Parameters:
        gen - generator to produce randomized input data
        condition - the property to be tested
        errorConsumer - consumer that takes the value that made the test fail
        random - the initial seed