Package ar.edu.unlp.yaqc4j

Examples of ar.edu.unlp.yaqc4j.Configuration


  private void processClassEnvironment() throws InstantiationException,
      IllegalAccessException {
    ar.edu.unlp.yaqc4j.annotations.Configuration config = this
        .getClassAnnotation(ar.edu.unlp.yaqc4j.annotations.Configuration.class);
    if (config != null) {
      this.configuration = new Configuration(config.distribution()
          .newInstance());
      if (config.maxsize() != Long.MAX_VALUE) {
        this.configuration.setMaxSize(config.maxsize());
      }
      if (config.minsize() != Long.MIN_VALUE) {
        this.configuration.setMinsize(config.minsize());
      }

      if (config.tests() != DEFAULT_NUMBER_OF_RUNS) {
        this.configuration.setMaxNumberOfTests(config.tests());
      }
      if (config.maxArgumentsFails() != MAX_ARGUMENTS_FAILS) {
        this.configuration.setMaxNumberOfFailedParams(config
            .maxArgumentsFails());
      }
    } else {
      this.configuration = new Configuration(
          Arbitrary.defaultDistribution());
    }
    // collect declared generators.
    this.classGenerators = new HashMap<Class<?>, Gen<?>>();
    Generator generator = this.getClassAnnotation(Generator.class);
View Full Code Here


      final FrameworkMethod method, final Object test) {
    try {
      Arbitrary.reset();
      processClassEnvironment();
      // config annotation process
      Configuration conf = (Configuration) this.configuration.clone();
      if (method
          .getAnnotation(ar.edu.unlp.yaqc4j.annotations.Configuration.class) != null) {
        ar.edu.unlp.yaqc4j.annotations.Configuration conf2 = method
            .getAnnotation(ar.edu.unlp.yaqc4j.annotations.Configuration.class);
        if (conf.getMaxNumberOfFailedParams() == QCCheckRunner.MAX_ARGUMENTS_FAILS
            && conf2.maxArgumentsFails() != QCCheckRunner.MAX_ARGUMENTS_FAILS) {
          conf.setMaxNumberOfFailedParams(conf2.maxArgumentsFails());
        }
        if (conf2.tests() != DEFAULT_NUMBER_OF_RUNS) {
          conf.setMaxNumberOfTests(conf2.tests());
        } else if (method.getMethod().getParameterTypes().length == 0){
          conf.setMaxNumberOfTests(DEFAULT_NUMBER_OF_RUNS);
        }
        if (conf.getMaxSize() == Long.MAX_VALUE
            && conf2.maxsize() != Long.MAX_VALUE) {
          conf.setMaxSize(conf2.maxsize());
        }
        if (conf.getMinsize() == Long.MIN_VALUE
            && conf2.minsize() != Long.MIN_VALUE) {
          conf.setMinsize(conf2.minsize());
        }
        if (conf.getRandom().getClass()
            .equals(Arbitrary.defaultDistribution().getClass())
            && conf2.distribution() != null) {
          conf.setDistribution(conf2.distribution().newInstance());
        }
      } else {
        if (method.getMethod().getParameterTypes().length == 0){
          conf.setMaxNumberOfTests(1);
        }
      }

      // custom generators in the method
      Map<Class<?>, Gen<?>> generators = new HashMap<Class<?>, Gen<?>>();
View Full Code Here

TOP

Related Classes of ar.edu.unlp.yaqc4j.Configuration

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.