### Question:
SinkUtils { public static String getAttributeString( AttributeSet att ) { if ( att == null ) { return ""; } StringBuilder sb = new StringBuilder(); Enumeration<?> names = att.getAttributeNames(); while ( names.hasMoreElements() ) { Object key = names.nextElement(); Object value = att.getAttribute( key ); if ( value instanceof AttributeSet ) { if ( SinkEventAttributes.STYLE.equals( key.toString() ) ) { sb.append( Markup.SPACE ).append( key.toString() ).append( Markup.EQUAL ) .append( Markup.QUOTE ).append( asCssString( (AttributeSet) value ) ) .append( Markup.QUOTE ); } } else { sb.append( Markup.SPACE ).append( key.toString() ).append( Markup.EQUAL ) .append( Markup.QUOTE ).append( value.toString() ).append( Markup.QUOTE ); } } return sb.toString(); } private  SinkUtils(); static String getAttributeString( AttributeSet att ); static MutableAttributeSet filterAttributes( AttributeSet attributes, String[] valids ); static final String[] SINK_BASE_ATTRIBUTES; static final String[] SINK_BR_ATTRIBUTES; static final String[] SINK_IMG_ATTRIBUTES; static final String[] SINK_SECTION_ATTRIBUTES; static final String[] SINK_VERBATIM_ATTRIBUTES; static final String[] SINK_HR_ATTRIBUTES; static final String[] SINK_LINK_ATTRIBUTES; static final String[] SINK_TABLE_ATTRIBUTES; static final String[] SINK_TD_ATTRIBUTES; static final String[] SINK_TR_ATTRIBUTES; }### Answer:
@Test public void testGetAttributeString() { assertEquals( "", SinkUtils.getAttributeString( null ) ); AttributeSet att = new SinkEventAttributeSet( SinkEventAttributeSet.BOXED ); String expResult = " decoration=\"boxed\""; String result = SinkUtils.getAttributeString( att ); assertEquals( expResult, result ); SinkEventAttributes at = new SinkEventAttributeSet( SinkEventAttributeSet.BOLD ); at.addAttributes( att ); expResult = " style=\"bold\" decoration=\"boxed\""; result = SinkUtils.getAttributeString( at ); assertEquals( expResult, result ); att = new SinkEventAttributeSet( "color", "red", "margin-left", "20px" ); at = new SinkEventAttributeSet(); at.addAttribute( SinkEventAttributeSet.STYLE, att ); expResult = " style=\"color: red; margin-left: 20px\""; result = SinkUtils.getAttributeString( at ); assertEquals( expResult, result ); }