@Test public void testWriteImageMapAsString() throws Exception { ImageMap imageMap = mockImageMap(); StringBuilder expectedValue = new StringBuilder(); expectedValue.append( "<map xmlns=\"" ); expectedValue.append( LibXmlInfo.XHTML_NAMESPACE ); expectedValue.append( "\" " ); expectedValue.append( MAP_NAME ); expectedValue.append( "=\"" ); expectedValue.append( MAP_VALUE ); expectedValue.append( "\"><area " ); expectedValue.append( MAP_ENTRY_NAME ); expectedValue.append( "=\"" ); expectedValue.append( MAP_ENTRY_VALUE ); expectedValue.append( "\" shape=\"" ); expectedValue.append( DEFAULT_SHAPE ); expectedValue.append( "\" coords=\"5.0,10.0,20.0,50.0\" /></map>" ); expectedValue.append( org.pentaho.reporting.libraries.base.util.StringUtils.getLineSeparator() ); String result = ImageMapWriter.writeImageMapAsString( imageMap ); assertThat( result, is( equalTo( expectedValue.toString() ) ) ); }
public static String writeImageMapAsString( final ImageMap imageMap ) { try { final DefaultTagDescription tagDescription = new DefaultTagDescription(); tagDescription.setDefaultNamespace( LibXmlInfo.XHTML_NAMESPACE ); tagDescription.setNamespaceHasCData( LibXmlInfo.XHTML_NAMESPACE, false ); final StringWriter sbwriter = new StringWriter( 5000 ); final XmlWriter writer = new XmlWriter( sbwriter ); writer.setHtmlCompatiblityMode( true ); writer.setWriteFinalLinebreak( true ); writeImageMap( writer, imageMap, 1 ); writer.close(); return sbwriter.toString(); } catch ( IOException ioe ) { throw new IllegalStateException( "Failed to write ImageMap - I am confused." ); } }
ImageMapWriter { public static String writeImageMapAsString( final ImageMap imageMap ) { try { final DefaultTagDescription tagDescription = new DefaultTagDescription(); tagDescription.setDefaultNamespace( LibXmlInfo.XHTML_NAMESPACE ); tagDescription.setNamespaceHasCData( LibXmlInfo.XHTML_NAMESPACE, false ); final StringWriter sbwriter = new StringWriter( 5000 ); final XmlWriter writer = new XmlWriter( sbwriter ); writer.setHtmlCompatiblityMode( true ); writer.setWriteFinalLinebreak( true ); writeImageMap( writer, imageMap, 1 ); writer.close(); return sbwriter.toString(); } catch ( IOException ioe ) { throw new IllegalStateException( "Failed to write ImageMap - I am confused." ); } } }
ImageMapWriter { public static String writeImageMapAsString( final ImageMap imageMap ) { try { final DefaultTagDescription tagDescription = new DefaultTagDescription(); tagDescription.setDefaultNamespace( LibXmlInfo.XHTML_NAMESPACE ); tagDescription.setNamespaceHasCData( LibXmlInfo.XHTML_NAMESPACE, false ); final StringWriter sbwriter = new StringWriter( 5000 ); final XmlWriter writer = new XmlWriter( sbwriter ); writer.setHtmlCompatiblityMode( true ); writer.setWriteFinalLinebreak( true ); writeImageMap( writer, imageMap, 1 ); writer.close(); return sbwriter.toString(); } catch ( IOException ioe ) { throw new IllegalStateException( "Failed to write ImageMap - I am confused." ); } } private  ImageMapWriter(); }
ImageMapWriter { public static String writeImageMapAsString( final ImageMap imageMap ) { try { final DefaultTagDescription tagDescription = new DefaultTagDescription(); tagDescription.setDefaultNamespace( LibXmlInfo.XHTML_NAMESPACE ); tagDescription.setNamespaceHasCData( LibXmlInfo.XHTML_NAMESPACE, false ); final StringWriter sbwriter = new StringWriter( 5000 ); final XmlWriter writer = new XmlWriter( sbwriter ); writer.setHtmlCompatiblityMode( true ); writer.setWriteFinalLinebreak( true ); writeImageMap( writer, imageMap, 1 ); writer.close(); return sbwriter.toString(); } catch ( IOException ioe ) { throw new IllegalStateException( "Failed to write ImageMap - I am confused." ); } } private  ImageMapWriter(); static String writeImageMapAsString( final ImageMap imageMap ); static void writeImageMap( final XmlWriter writer, final ImageMap imageMap, final double scale ); }
ImageMapWriter { public static String writeImageMapAsString( final ImageMap imageMap ) { try { final DefaultTagDescription tagDescription = new DefaultTagDescription(); tagDescription.setDefaultNamespace( LibXmlInfo.XHTML_NAMESPACE ); tagDescription.setNamespaceHasCData( LibXmlInfo.XHTML_NAMESPACE, false ); final StringWriter sbwriter = new StringWriter( 5000 ); final XmlWriter writer = new XmlWriter( sbwriter ); writer.setHtmlCompatiblityMode( true ); writer.setWriteFinalLinebreak( true ); writeImageMap( writer, imageMap, 1 ); writer.close(); return sbwriter.toString(); } catch ( IOException ioe ) { throw new IllegalStateException( "Failed to write ImageMap - I am confused." ); } } private  ImageMapWriter(); static String writeImageMapAsString( final ImageMap imageMap ); static void writeImageMap( final XmlWriter writer, final ImageMap imageMap, final double scale );  }