@Test public void checkDecodeFailure() { Color color = GraphUtils.decode( "invalidColor", "#000000" ); Assert.assertEquals( color.getBlue(), 0 ); Assert.assertEquals( color.getRed(), 0 ); Assert.assertEquals( color.getGreen(), 0 ); }
static Color decode( String value, String defaultValue ) { Color result; try { result = Color.decode( value ); } catch( NumberFormatException e ) { Logger logger = Logger.getLogger( GraphUtils.class.getName()); logger.severe( "The specified color " + value + " could not be parsed. Back to default value: " + defaultValue ); Utils.logException( logger, e ); result = Color.decode( defaultValue ); } return result; }
GraphUtils { static Color decode( String value, String defaultValue ) { Color result; try { result = Color.decode( value ); } catch( NumberFormatException e ) { Logger logger = Logger.getLogger( GraphUtils.class.getName()); logger.severe( "The specified color " + value + " could not be parsed. Back to default value: " + defaultValue ); Utils.logException( logger, e ); result = Color.decode( defaultValue ); } return result; } }
GraphUtils { static Color decode( String value, String defaultValue ) { Color result; try { result = Color.decode( value ); } catch( NumberFormatException e ) { Logger logger = Logger.getLogger( GraphUtils.class.getName()); logger.severe( "The specified color " + value + " could not be parsed. Back to default value: " + defaultValue ); Utils.logException( logger, e ); result = Color.decode( defaultValue ); } return result; } private  GraphUtils(); }
GraphUtils { static Color decode( String value, String defaultValue ) { Color result; try { result = Color.decode( value ); } catch( NumberFormatException e ) { Logger logger = Logger.getLogger( GraphUtils.class.getName()); logger.severe( "The specified color " + value + " could not be parsed. Back to default value: " + defaultValue ); Utils.logException( logger, e ); result = Color.decode( defaultValue ); } return result; } private  GraphUtils(); static int computeShapeWidth( AbstractType type ); static Font getDefaultFont(); static void writeGraph(
			File outputFile,
			Component selectedComponent,
			Layout<AbstractType,String> layout,
			Graph<AbstractType,String> graph ,
			AbstractEdgeShapeTransformer<AbstractType,String> edgeShapeTransformer,
			Map<String,String> options ); }
GraphUtils { static Color decode( String value, String defaultValue ) { Color result; try { result = Color.decode( value ); } catch( NumberFormatException e ) { Logger logger = Logger.getLogger( GraphUtils.class.getName()); logger.severe( "The specified color " + value + " could not be parsed. Back to default value: " + defaultValue ); Utils.logException( logger, e ); result = Color.decode( defaultValue ); } return result; } private  GraphUtils(); static int computeShapeWidth( AbstractType type ); static Font getDefaultFont(); static void writeGraph(
			File outputFile,
			Component selectedComponent,
			Layout<AbstractType,String> layout,
			Graph<AbstractType,String> graph ,
			AbstractEdgeShapeTransformer<AbstractType,String> edgeShapeTransformer,
			Map<String,String> options ); static final int SHAPE_HEIGHT; }