### Question:
DefaultProblem implements Problem { public String getLocation() { StringBuilder buffer = new StringBuilder( 256 ); if ( getSource().length() > 0 ) { if ( buffer.length() > 0 ) { buffer.append( ", " ); } buffer.append( getSource() ); } if ( getLineNumber() > 0 ) { if ( buffer.length() > 0 ) { buffer.append( ", " ); } buffer.append( "line " ).append( getLineNumber() ); } if ( getColumnNumber() > 0 ) { if ( buffer.length() > 0 ) { buffer.append( ", " ); } buffer.append( "column " ).append( getColumnNumber() ); } return buffer.toString(); } DefaultProblem( String message, Severity severity, String source, int lineNumber, int columnNumber,
                                   Exception exception ); String getSource(); int getLineNumber(); int getColumnNumber(); String getLocation(); Exception getException(); String getMessage(); Severity getSeverity(); @Override String toString();  }### Answer:
@Test public void testGetLocation() { DefaultProblem problem = new DefaultProblem( null, null, null, -1, -1, null ); assertEquals( "", problem.getLocation() ); problem = new DefaultProblem( null, null, "SOURCE", -1, -1, null ); assertEquals( "SOURCE", problem.getLocation() ); problem = new DefaultProblem( null, null, null, 42, -1, null ); assertEquals( "line 42", problem.getLocation() ); problem = new DefaultProblem( null, null, null, -1, 127, null ); assertEquals( "column 127", problem.getLocation() ); problem = new DefaultProblem( null, null, "SOURCE", 42, 127, null ); assertEquals( "SOURCE, line 42, column 127", problem.getLocation() ); }