import co.wuunder.rule_engine.*; import org.junit.jupiter.api.Test; import java.util.List; import java.util.Random; import static co.wuunder.rule_engine.RateRules.*; public class PerfTest { private final RuleEngine ruleEngine = new RuleEngine(RateRules.rules(100_000)); @Test public void perf() { long start = System.currentTimeMillis(); int numberOfShipments = 50; for(int i = 0 ; i < numberOfShipments; i++) { ruleEngine.generateRules(shipment()); } long end = System.currentTimeMillis(); System.out.println((end - start) / numberOfShipments); } private Shipment randomShipment() { Random random = new Random(System.currentTimeMillis()); Address pickupAddress = new Address("NL", ""); Address deliveryAddress = new Address("NL", ""); return new Shipment(random.nextInt(), random.nextInt(), random.nextInt(), random.nextInt(), random.nextInt() % 2 == 0, random.nextInt() % 2 == 0, pickupAddress, deliveryAddress); } private Shipment shipment() { Address pickupAddress = new Address("NL", ""); Address deliveryAddress = new Address("NL", ""); return new Shipment(10, 10, 10, 10, false, false, pickupAddress, deliveryAddress); } }