I need to throw a couple times a custom exception. A test class is checking if my solution works but I'm not allowed to make any changes to this class which leads me to my problem. I simplified the problem here, because the whole code is not needed here
public class Test{
public static final String s = "0test";
@Test
public void testZero(){
Solver sol = new Solver(Parser.run(s));
//IntelliJ is underlining "run" because "Unhandled exception: ParseException", a
//simple solution could be adding "throws ParseException" in the head, but I'm not
//allowed to change the test class
}
}
public class Parser{
public static Pars run(String input) throws ParseException{
if(input.charAt(0) == '0'){
throw new ParseException("...");
}
}
}
public class ParseException extends Exception{
public ParseException(String mess){
super(mess);
}
}