All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jio.test.pbt.ParProperty Maven / Gradle / Ivy

Go to download

JIO test library based on Property Based Testing and Java Flight Recording Debuggers

There is a newer version: 3.0.0-RC2
Show newest version
package jio.test.pbt;

import jio.IO;
import jio.ListExp;
import jsonvalues.JsObj;


non-sealed class ParProperty extends Testable {

  final int executionTimes;

  final Property prop;

  ParProperty(int executionTimes,
              Property prop) {
    this.executionTimes = executionTimes;
    this.prop = prop;
  }

  @Override
  IO createTask(JsObj conf) {
    if (executionTimes < 1) {
      throw new IllegalArgumentException("n < 1");
    }
    final IO test = prop.createTask(conf);
    var result = ListExp.par(test);
    for (int i = 1; i < executionTimes; i++) {
      result = result.append(test);
    }
    return result.map(it -> it.stream()
                              .reduce(Report::aggregatePar)
                              .get());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy