### Question:
SvgDataUriGenerator { @SuppressWarnings("unchecked") public String generate(final SafeUri svgUri) { return generate(svgUri, Collections.EMPTY_LIST, Collections.EMPTY_LIST); }  static String encodeUtf8(final String dataUriDecoded); static String encodeBase64(final String dataUriDecoded); @SuppressWarnings("unchecked") String generate(final SafeUri svgUri); String generate(final SafeUri svgUri,
                           final Collection<SafeUri> svgDefs,
                           final Collection<String> validUseRefIds); static final String SVG_CONTENT_TYPE; static final String SVG_DATA_URI_BASE64; static final String SVG_DATA_URI_UTF8; }### Answer:
@Test public void testNoProcessing() { assertEquals(SVG_CONTENT, tested.generate(simpleUri)); }
@Test public void testSingle() { final String singleSvgContent = tested.generate(taskUri); assertTrue(singleSvgContent.contains("<svg id=\"Layer_Main\"")); assertFalse(singleSvgContent.contains("<\\?xml")); assertFalse(singleSvgContent.contains("<use")); }
@Test public void testComposite() { final List<SafeUri> defs = Arrays.asList(taskUserUri, taskScriptUri); final List<String> defIds = Arrays.asList("Layer_2", "Layer_3"); String compositeSvgContent = tested.generate(taskUri, defs, defIds); assertFalse(compositeSvgContent.contains("<\\?xml")); assertEquals(97, compositeSvgContent.indexOf("width=\"448\"")); assertEquals(109, compositeSvgContent.indexOf("height=\"448\"")); assertEquals(122, compositeSvgContent.indexOf("viewBox=\"0 0 448 448\"")); assertTrue(compositeSvgContent.contains("viewBox=\"0 0 448 448\"")); assertTrue(compositeSvgContent.contains("<svg id=\"Layer_Main\"")); assertTrue(compositeSvgContent.contains("<svg id=\"Layer_2\"")); assertTrue(compositeSvgContent.contains("<svg id=\"Layer_3\"")); assertTrue(compositeSvgContent.contains("<use xlink:href=\"#Layer_2\"")); assertTrue(compositeSvgContent.contains("<use xlink:href=\"#Layer_3\"")); }
@Test public void testFiltered() { String filteredSvgContent = tested.generate(taskUri, Arrays.asList(taskScriptUri, taskUserUri), Arrays.asList("Layer_3")); assertFalse(filteredSvgContent.contains("<\\?xml")); assertEquals(97, filteredSvgContent.indexOf("width=\"448\"")); assertEquals(109, filteredSvgContent.indexOf("height=\"448\"")); assertEquals(122, filteredSvgContent.indexOf("viewBox=\"0 0 448 448\"")); assertTrue(filteredSvgContent.contains("<svg id=\"Layer_Main\"")); assertTrue(filteredSvgContent.contains("<svg id=\"Layer_2\"")); assertTrue(filteredSvgContent.contains("<svg id=\"Layer_3\"")); assertFalse(filteredSvgContent.contains("<use xlink:href=\"#Layer_2\"")); assertTrue(filteredSvgContent.contains("<use xlink:href=\"#Layer_3\"")); }