From c03f1b1f21f16c81fcfad664285ac0f024e08e3c Mon Sep 17 00:00:00 2001 From: Timur Shafigullin Date: Wed, 5 Oct 2022 07:31:22 +0300 Subject: [PATCH] handling case when there are no tests in testable summary (via #37) --- .../eroshenkoam/xcresults/export/ExportCommand.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/eroshenkoam/xcresults/export/ExportCommand.java b/src/main/java/io/eroshenkoam/xcresults/export/ExportCommand.java index 528dfe4..d09fe97 100644 --- a/src/main/java/io/eroshenkoam/xcresults/export/ExportCommand.java +++ b/src/main/java/io/eroshenkoam/xcresults/export/ExportCommand.java @@ -120,10 +120,14 @@ private void runUnsafe() throws Exception { for (JsonNode summary : testRef.get(SUMMARIES).get(VALUES)) { for (JsonNode testableSummary : summary.get(TESTABLE_SUMMARIES).get(VALUES)) { final ExportMeta testMeta = getTestMeta(meta, testableSummary); - for (JsonNode test : testableSummary.get(TESTS).get(VALUES)) { - getTestSummaries(test).forEach(testSummary -> { - testSummaries.put(testSummary, testMeta); - }); + if (testableSummary.has(TESTS) && testableSummary.get(TESTS).has(VALUES)) { + for (JsonNode test : testableSummary.get(TESTS).get(VALUES)) { + getTestSummaries(test).forEach(testSummary -> { + testSummaries.put(testSummary, testMeta); + }); + } + } else { + System.out.printf("No tests found for '%s'%n", testableSummary.get("name").get(VALUE)); } } }