@Test public void testStartParsing() throws SAXException { ElementStyleSheet styleSheet = mock( ElementStyleSheet.class ); Attributes attrs = mock( Attributes.class ); doReturn( TEST_URI ).when( handler ).getUri(); handler.setStyleSheet( styleSheet ); assertThat( handler.getObject(), is( instanceOf( ElementStyleSheet.class ) ) ); assertThat( (ElementStyleSheet) handler.getObject(), is( equalTo( styleSheet ) ) ); handler.startParsing( attrs ); verify( styleSheet, never() ).setStyleProperty( any( StyleKey.class ), anyObject() ); doReturn( "black" ).when( attrs ).getValue( TEST_URI, "high-color" ); doReturn( "blue" ).when( attrs ).getValue( TEST_URI, "last-color" ); doReturn( "gray" ).when( attrs ).getValue( TEST_URI, "low-color" ); doReturn( "yellow" ).when( attrs ).getValue( TEST_URI, "medium-color" ); handler.startParsing( attrs ); verify( styleSheet ).setStyleProperty( SparklineStyleKeys.HIGH_COLOR, Color.BLACK ); verify( styleSheet ).setStyleProperty( SparklineStyleKeys.LAST_COLOR, Color.BLUE ); verify( styleSheet ).setStyleProperty( SparklineStyleKeys.LOW_COLOR, Color.GRAY ); verify( styleSheet ).setStyleProperty( SparklineStyleKeys.MEDIUM_COLOR, Color.YELLOW ); }
protected void startParsing( final Attributes attrs ) throws SAXException { final String highColor = attrs.getValue( getUri(), "high-color" ); if ( highColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.HIGH_COLOR, ReportParserUtil.parseColor( highColor, null ) ); } final String lastColor = attrs.getValue( getUri(), "last-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.LAST_COLOR, ReportParserUtil.parseColor( lastColor, null ) ); } final String lowColor = attrs.getValue( getUri(), "low-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.LOW_COLOR, ReportParserUtil.parseColor( lowColor, null ) ); } final String mediumColor = attrs.getValue( getUri(), "medium-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.MEDIUM_COLOR, ReportParserUtil.parseColor( mediumColor, null ) ); } }
SparklineStylesReadHandler extends AbstractXmlReadHandler implements StyleReadHandler { protected void startParsing( final Attributes attrs ) throws SAXException { final String highColor = attrs.getValue( getUri(), "high-color" ); if ( highColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.HIGH_COLOR, ReportParserUtil.parseColor( highColor, null ) ); } final String lastColor = attrs.getValue( getUri(), "last-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.LAST_COLOR, ReportParserUtil.parseColor( lastColor, null ) ); } final String lowColor = attrs.getValue( getUri(), "low-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.LOW_COLOR, ReportParserUtil.parseColor( lowColor, null ) ); } final String mediumColor = attrs.getValue( getUri(), "medium-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.MEDIUM_COLOR, ReportParserUtil.parseColor( mediumColor, null ) ); } } }
SparklineStylesReadHandler extends AbstractXmlReadHandler implements StyleReadHandler { protected void startParsing( final Attributes attrs ) throws SAXException { final String highColor = attrs.getValue( getUri(), "high-color" ); if ( highColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.HIGH_COLOR, ReportParserUtil.parseColor( highColor, null ) ); } final String lastColor = attrs.getValue( getUri(), "last-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.LAST_COLOR, ReportParserUtil.parseColor( lastColor, null ) ); } final String lowColor = attrs.getValue( getUri(), "low-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.LOW_COLOR, ReportParserUtil.parseColor( lowColor, null ) ); } final String mediumColor = attrs.getValue( getUri(), "medium-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.MEDIUM_COLOR, ReportParserUtil.parseColor( mediumColor, null ) ); } }  }
SparklineStylesReadHandler extends AbstractXmlReadHandler implements StyleReadHandler { protected void startParsing( final Attributes attrs ) throws SAXException { final String highColor = attrs.getValue( getUri(), "high-color" ); if ( highColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.HIGH_COLOR, ReportParserUtil.parseColor( highColor, null ) ); } final String lastColor = attrs.getValue( getUri(), "last-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.LAST_COLOR, ReportParserUtil.parseColor( lastColor, null ) ); } final String lowColor = attrs.getValue( getUri(), "low-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.LOW_COLOR, ReportParserUtil.parseColor( lowColor, null ) ); } final String mediumColor = attrs.getValue( getUri(), "medium-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.MEDIUM_COLOR, ReportParserUtil.parseColor( mediumColor, null ) ); } }  Object getObject(); void setStyleSheet( final ElementStyleSheet styleSheet ); }
SparklineStylesReadHandler extends AbstractXmlReadHandler implements StyleReadHandler { protected void startParsing( final Attributes attrs ) throws SAXException { final String highColor = attrs.getValue( getUri(), "high-color" ); if ( highColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.HIGH_COLOR, ReportParserUtil.parseColor( highColor, null ) ); } final String lastColor = attrs.getValue( getUri(), "last-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.LAST_COLOR, ReportParserUtil.parseColor( lastColor, null ) ); } final String lowColor = attrs.getValue( getUri(), "low-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.LOW_COLOR, ReportParserUtil.parseColor( lowColor, null ) ); } final String mediumColor = attrs.getValue( getUri(), "medium-color" ); if ( lastColor != null ) { styleSheet.setStyleProperty( SparklineStyleKeys.MEDIUM_COLOR, ReportParserUtil.parseColor( mediumColor, null ) ); } }  Object getObject(); void setStyleSheet( final ElementStyleSheet styleSheet );  }