### Question:
ExceptionParser { public static String getErrorHeader( Throwable throwable, String defaultErrorHeader ) { String message = throwable.getLocalizedMessage(); if ( message != null && message.length() > 0 ) { int index = message.indexOf( DELIMETER ); if ( index > 0 ) { return message.substring( 0, index - 1 ); } else { return defaultErrorHeader; } } else { return defaultErrorHeader; } }  static String getErrorMessage( Throwable throwable, String defaultErrorMessage ); static String getErrorHeader( Throwable throwable, String defaultErrorHeader ); static String DELIMETER; }### Answer:
@Test public void testGetErrorHeader() { Exception ex = new Exception( "my test message" ); assertEquals( "default", ExceptionParser.getErrorHeader( ex, "default" ) ); ex = new Exception( "" ); assertEquals( "default", ExceptionParser.getErrorHeader( ex, "default" ) ); ex = new Exception( "header - body" ); assertEquals( "header", ExceptionParser.getErrorHeader( ex, "default" ) ); }