| Conditions | 4 |
| Total Lines | 11 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package com.hltech.pact.gen.domain.pact; |
||
| 22 | private void writePactFile(File destinationDir, Pact pact) { |
||
| 23 | if (destinationDir != null && !destinationDir.exists()) { |
||
| 24 | destinationDir.mkdirs(); |
||
| 25 | } |
||
| 26 | |||
| 27 | final String pactFileName = pact.getConsumer().getName() + "-" + pact.getProvider().getName() + ".json"; |
||
| 28 | try { |
||
| 29 | objectMapper.writeValue(new File(destinationDir, pactFileName), pact); |
||
| 30 | } catch (IOException ex) { |
||
| 31 | log.error("Unable to write {} to json file", pact); |
||
| 32 | throw new PactGenerationException("Unable to write pact to json file", ex); |
||
| 33 | } |
||
| 36 |