### Question:
ToolchainsBuildingException extends Exception { public List<Problem> getProblems() { return problems; } ToolchainsBuildingException( List<Problem> problems ); List<Problem> getProblems();  }### Answer:
@Test public void testOneProblem() { ProblemCollector problemCollector = ProblemCollectorFactory.newInstance( null ); problemCollector.add( Problem.Severity.ERROR, "MESSAGE", 3, 5, new Exception() ); ToolchainsBuildingException e = new ToolchainsBuildingException( problemCollector.getProblems() ); assertEquals( "1 problem was encountered while building the effective toolchains" + LS + "[ERROR] MESSAGE @ line 3, column 5" + LS, e.getMessage() ); }
@Test public void testUnknownPositionAndSource() { ProblemCollector problemCollector = ProblemCollectorFactory.newInstance( null ); problemCollector.add( Problem.Severity.ERROR, "MESSAGE", -1, -1, new Exception() ); ToolchainsBuildingException e = new ToolchainsBuildingException( problemCollector.getProblems() ); assertEquals( "1 problem was encountered while building the effective toolchains" + LS + "[ERROR] MESSAGE" + LS, e.getMessage() ); }
@Test public void testUnknownPosition() { ProblemCollector problemCollector = ProblemCollectorFactory.newInstance( null ); problemCollector.setSource( "SOURCE" ); problemCollector.add( Problem.Severity.ERROR, "MESSAGE", -1, -1, new Exception() ); ToolchainsBuildingException e = new ToolchainsBuildingException( problemCollector.getProblems() ); assertEquals( "1 problem was encountered while building the effective toolchains" + LS + "[ERROR] MESSAGE @ SOURCE" + LS, e.getMessage() ); }