### Question:
ExportOptionsMapper { public ExecutionRequestOptions transform(ReportExportOptions options) { ExecutionRequestOptions resultOptions = ExecutionRequestOptions.create(); ReportFormat format = options.getFormat(); resultOptions.withOutputFormat(format.toString().toLowerCase()); PageRange pageRange = options.getPageRange(); if (pageRange != null) { resultOptions.withPages(pageRange.toString()); } String prefix = options.getAttachmentPrefix(); if (prefix != null) { resultOptions.withAttachmentsPrefix(prefix); } ReportMarkup markup = options.getMarkupType(); if (markup != null) { resultOptions.withMarkupType(markup.toString().toLowerCase()); } resultOptions.withIgnorePagination(options.getIgnorePagination()); resultOptions.withAnchor(options.getAnchor()); resultOptions.withAllowInlineScripts(options.getAllowInlineScripts()); resultOptions.withBaseUrl(mBaseUrl); return resultOptions; } protected  ExportOptionsMapper(String baseUrl); static ExportOptionsMapper create(ServerVersion serverVersion, String baseUrl); ExecutionRequestOptions transform(ReportExportOptions options);  }### Answer:
@Test public void should_map_format() { ReportExportOptions criteria = ReportExportOptions.builder() .withFormat(ReportFormat.PDF) .build(); ExecutionRequestOptions options = mapper.transform(criteria); assertThat("Failed to map 'format' option", options.getOutputFormat(), is("pdf")); }
@Test public void should_map_pages() { PageRange range = PageRange.parse("1-10"); ReportExportOptions criteria = ReportExportOptions.builder() .withFormat(ReportFormat.PDF) .withPageRange(range) .build(); ExecutionRequestOptions options = mapper.transform(criteria); assertThat("Failed to map 'pages' option", options.getPages(), is("1-10")); }
@Test public void should_include_ignore_pagination_flag() throws Exception { ReportExportOptions criteria = ReportExportOptions.builder() .withFormat(ReportFormat.PDF) .withIgnorePagination(true) .build(); ExecutionRequestOptions options = mapper.transform(criteria); assertThat("Failed to map 'ignorePagination' option", options.getIgnorePagination(), is(true)); }
@Test public void should_map_anchor() { ReportExportOptions criteria = ReportExportOptions.builder() .withFormat(ReportFormat.PDF) .withAnchor("anchor") .build(); ExecutionRequestOptions options = mapper.transform(criteria); assertThat("Failed to map 'anchor' option", options.getAnchor(), is("anchor")); }
@Test public void should_map_attachmentPrefix() { ReportExportOptions criteria = ReportExportOptions.builder() .withFormat(ReportFormat.PDF) .withAttachmentPrefix("./") .build(); ExecutionRequestOptions options = mapper.transform(criteria); assertThat("Failed to map 'attachmentPrefix' option", options.getAttachmentsPrefix(), is("./")); }
@Test public void should_map_allowInlineScripts() { ReportExportOptions criteria = ReportExportOptions.builder() .withFormat(ReportFormat.PDF) .withAllowInlineScripts(true) .build(); ExecutionRequestOptions options = mapper.transform(criteria); assertThat("Failed to map 'allowInlineScripts' option", options.getAllowInlineScripts(), is(true)); }
@Test public void should_map_baseUrl() { ReportExportOptions criteria = ReportExportOptions.builder() .withFormat(ReportFormat.PDF) .build(); ExecutionRequestOptions options = mapper.transform(criteria); assertThat("Failed to map 'baseUrl' option", options.getBaseUrl(), is(BASE_URL)); }