diff --git a/src/main/java/com/regnosys/testing/pipeline/PipelineTestPackWriter.java b/src/main/java/com/regnosys/testing/pipeline/PipelineTestPackWriter.java index a640f83..a620559 100644 --- a/src/main/java/com/regnosys/testing/pipeline/PipelineTestPackWriter.java +++ b/src/main/java/com/regnosys/testing/pipeline/PipelineTestPackWriter.java @@ -159,11 +159,12 @@ private TestPackModel writeTestPackSamples(Path resourcesPath, Path inputPath, P } private String updateFileExtensionBasedOnOutputFormat(PipelineModel pipelineModel, String fileName) { - if (pipelineModel.getOutputSerialisation() != null) { - String outputFormat = pipelineModel.getOutputSerialisation().getFormat().toString().toLowerCase(); - return fileName.substring(0, fileName.lastIndexOf(".")) + "." + outputFormat; - } - return fileName; + String outputFormat = Optional.ofNullable(pipelineModel.getOutputSerialisation()) + .map(PipelineModel.Serialisation::getFormat) + .map(PipelineModel.Serialisation.Format::toString) + .orElse("json") + .toLowerCase(); + return fileName.substring(0, fileName.lastIndexOf(".")) + "." + outputFormat; } private Map> filterAndGroupingByTestPackId(Path resourcesPath, Path inputPath, List inputSamples, Predicate testPackSampleInclusionFilter) {