FunctionFileName implements FileName { @Override public String getName(int executionNumber) { String name = nameFunc.apply(executionNumber); if (validator != null) { validator.accept(name); } return name; } FunctionFileName(Function<Integer, String> nameFunc, Consumer<String> validator); @Override String getName(int executionNumber); @Override boolean dependsOnExecutionNumber();  }
@Test(expected = RuntimeException.class) public void checkTest() { FunctionFileName fileName = new FunctionFileName(executionNumber -> "file-" + executionNumber, s -> { throw new PowsyblException("error"); } ); fileName.getName(0); }