@Test(expected = TDPException.class) public void shouldNotReturnAnything() { service.getWriter("toto", output, Collections.emptyMap()); }
public TransformerWriter getWriter(String format, OutputStream output, Map<String, String> parameters) { try { final ExportFormat formatByName = formatRegistrationService.getByName(format); if (formatByName == null || !formatByName.isEnabled()) { throw new TDPException(UNABLE_TO_USE_EXPORT, ExceptionContext.build().put("format", format)); } if (parameters.isEmpty()) { return (TransformerWriter) context.getBean("writer#" + format, output); } else { return (TransformerWriter) context.getBean("writer#" + format, output, parameters); } } catch (BeansException be) { throw new TDPException(TransformationErrorCodes.OUTPUT_TYPE_NOT_SUPPORTED, be); } }
WriterRegistrationService { public TransformerWriter getWriter(String format, OutputStream output, Map<String, String> parameters) { try { final ExportFormat formatByName = formatRegistrationService.getByName(format); if (formatByName == null || !formatByName.isEnabled()) { throw new TDPException(UNABLE_TO_USE_EXPORT, ExceptionContext.build().put("format", format)); } if (parameters.isEmpty()) { return (TransformerWriter) context.getBean("writer#" + format, output); } else { return (TransformerWriter) context.getBean("writer#" + format, output, parameters); } } catch (BeansException be) { throw new TDPException(TransformationErrorCodes.OUTPUT_TYPE_NOT_SUPPORTED, be); } } }
WriterRegistrationService { public TransformerWriter getWriter(String format, OutputStream output, Map<String, String> parameters) { try { final ExportFormat formatByName = formatRegistrationService.getByName(format); if (formatByName == null || !formatByName.isEnabled()) { throw new TDPException(UNABLE_TO_USE_EXPORT, ExceptionContext.build().put("format", format)); } if (parameters.isEmpty()) { return (TransformerWriter) context.getBean("writer#" + format, output); } else { return (TransformerWriter) context.getBean("writer#" + format, output, parameters); } } catch (BeansException be) { throw new TDPException(TransformationErrorCodes.OUTPUT_TYPE_NOT_SUPPORTED, be); } }  }
WriterRegistrationService { public TransformerWriter getWriter(String format, OutputStream output, Map<String, String> parameters) { try { final ExportFormat formatByName = formatRegistrationService.getByName(format); if (formatByName == null || !formatByName.isEnabled()) { throw new TDPException(UNABLE_TO_USE_EXPORT, ExceptionContext.build().put("format", format)); } if (parameters.isEmpty()) { return (TransformerWriter) context.getBean("writer#" + format, output); } else { return (TransformerWriter) context.getBean("writer#" + format, output, parameters); } } catch (BeansException be) { throw new TDPException(TransformationErrorCodes.OUTPUT_TYPE_NOT_SUPPORTED, be); } }  TransformerWriter getWriter(String format, OutputStream output, Map<String, String> parameters); }
WriterRegistrationService { public TransformerWriter getWriter(String format, OutputStream output, Map<String, String> parameters) { try { final ExportFormat formatByName = formatRegistrationService.getByName(format); if (formatByName == null || !formatByName.isEnabled()) { throw new TDPException(UNABLE_TO_USE_EXPORT, ExceptionContext.build().put("format", format)); } if (parameters.isEmpty()) { return (TransformerWriter) context.getBean("writer#" + format, output); } else { return (TransformerWriter) context.getBean("writer#" + format, output, parameters); } } catch (BeansException be) { throw new TDPException(TransformationErrorCodes.OUTPUT_TYPE_NOT_SUPPORTED, be); } }  TransformerWriter getWriter(String format, OutputStream output, Map<String, String> parameters);  }