Package com.pholser.junit.quickcheck.random

Examples of com.pholser.junit.quickcheck.random.SourceOfRandomness


        String argument = "foobar";

        Random r = new Random();
        r.setSeed(Objects.hashCode(argument));
        Integer value = (Integer) repository.generatorFor(Integer.class).generate(new SourceOfRandomness(r), null);

        for (int i = 0; i < 10000; ++i)
            assertEquals(value, f.apply(argument));
    }
View Full Code Here


    }

    private static <T> T functionValue(Generator<T> generator, Object[] args) {
        Random r = new Random();
        r.setSeed(java.util.Arrays.hashCode(args));
        return generator.generate(new SourceOfRandomness(r), null);
    }
View Full Code Here

        @Override public Object invoke(Object proxy, Method method, Object[] args) {
            if (Object.class.equals(method.getDeclaringClass()))
                return handleObjectMethod(proxy, method, args);

            random.setSeed(Arrays.hashCode(args));
            return returnValueGenerator.generate(new SourceOfRandomness(random), status);
        }
View Full Code Here

    private final RandomTheoryParameterGenerator generator;

    /* Called by JUnit reflectively. */
    public RandomValueSupplier() {
        generator = new RandomTheoryParameterGenerator(
            new SourceOfRandomness(new SecureRandom()),
            new GeneratorRepository(new SourceOfRandomness(new SecureRandom()))
                .register(new ServiceLoaderGeneratorSource()));
    }
View Full Code Here

TOP

Related Classes of com.pholser.junit.quickcheck.random.SourceOfRandomness

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.