Equivilient of coldfusion.runtime.MissingArgumentException

I’m working on trying to get an application up and running in Lucee 5. There are some places (mainly unit tests) that are relying on the ColdFusion “coldfusion.runtime.MissingArgumentException” exception to determine if required arguments are missing.

When I dump a stack trace, it would appear the equivalent exception would be lucee.runtime.exp.ExpressionException.

However, at least for MXUnit, replacing expectException(“coldfusion.runtime.MissingArgumentException”) with expectionException(“lucee.runtime.exp.ExpressionException”) does not work.

MXUnit unit checks either the exception’s “type” string (which Lucee returns as “expression”) or getMetaData(exception).getName() (which Lucee returns as “lucee.runtime.exp.CatchBlockImpl”).

I think the issue is that MXUnit is doing a try/catch so the original exception is getting lost.

Any one know how I might fix the unit tests for Lucee?

Hi Dan. I don’t have a direct answer, but it might be worth trying to run your tests with TestBox in MXUnit compatible mode to see if that works any better with the Lucee exception.

As you say the Lucee exception type isn’t very specific. In my TestBox BDD tests I would probably check the contents of the exception message using:

expect( code ).toThrow( regex: "required but was not passed in" );