(Exchange exchange, Object tests, Object isPublicTest)
| 596 | } |
| 597 | |
| 598 | public java.util.concurrent.CompletableFuture<Object> runTests(Exchange exchange, Object tests, Object isPublicTest) |
| 599 | { |
| 600 | |
| 601 | return java.util.concurrent.CompletableFuture.supplyAsync(() -> { |
| 602 | |
| 603 | Object testNames = Helpers.objectKeys(tests); |
| 604 | Object promises = new java.util.ArrayList<Object>(java.util.Arrays.asList()); |
| 605 | for (var i = 0; Helpers.isLessThan(i, Helpers.getArrayLength(testNames)); i++) |
| 606 | { |
| 607 | Object testName = Helpers.GetValue(testNames, i); |
| 608 | Object testArgs = Helpers.GetValue(tests, testName); |
| 609 | ((java.util.List<Object>)promises).add(this.testSafe(testName, exchange, testArgs, isPublicTest)); |
| 610 | } |
| 611 | // todo - not yet ready in other langs too |
| 612 | // promises.push (testThrottle ()); |
| 613 | Object results = (Helpers.promiseAll(promises)).join(); |
| 614 | // now count which test-methods retuned `false` from "testSafe" and dump that info below |
| 615 | Object failedMethods = new java.util.ArrayList<Object>(java.util.Arrays.asList()); |
| 616 | for (var i = 0; Helpers.isLessThan(i, Helpers.getArrayLength(testNames)); i++) |
| 617 | { |
| 618 | Object testName = Helpers.GetValue(testNames, i); |
| 619 | Object testReturnedValue = Helpers.GetValue(results, i); |
| 620 | if (!Helpers.isTrue(testReturnedValue)) |
| 621 | { |
| 622 | ((java.util.List<Object>)failedMethods).add(testName); |
| 623 | } |
| 624 | } |
| 625 | Object testPrefixString = ((Helpers.isTrue(isPublicTest))) ? "PUBLIC_TESTS" : "PRIVATE_TESTS"; |
| 626 | if (Helpers.isTrue(Helpers.getArrayLength(failedMethods))) |
| 627 | { |
| 628 | Object errorsString = String.join((String)", ", (java.util.List<String>)failedMethods); |
| 629 | dump("[TEST_FAILURE]", exchange.id, testPrefixString, Helpers.add("Failed methods : ", errorsString)); |
| 630 | } |
| 631 | if (Helpers.isTrue(this.info)) |
| 632 | { |
| 633 | dump(this.addPadding(Helpers.add(Helpers.add(Helpers.add("[INFO] END ", testPrefixString), " "), exchange.id), 25)); |
| 634 | } |
| 635 | return true; |
| 636 | }); |
| 637 | |
| 638 | } |
| 639 | |
| 640 | public java.util.concurrent.CompletableFuture<Object> loadExchange(Exchange exchange) |
| 641 | { |
no test coverage detected