We should discourage an unbounded number of parameters being passed in the middle of a function with optional parameters at the end. With newer versions of MarkLogic we have support for anonymous functions, and should encourage the use of anonymous functions to invoke arbitrary code that is expected to throw an error.
Instead of passing in the method reference, and parameters as follows:
The existing functions should be left in place for now, and we should log an info level message letting the client know that the methods are deprecated and will be removed in a future release.
deprecate each of the functions https://github.com/marklogic-community/marklogic-unit-test/blob/63a8aa4a36d1d2576469a8972ec91960b204a980/marklogic-unit-test-modules/src/main/ml-modules/root/test/test-helper.xqy#L816
deprecate each of the functions https://github.com/marklogic-community/marklogic-unit-test/blob/63a8aa4a36d1d2576469a8972ec91960b204a980/marklogic-unit-test-modules/src/main/ml-modules/root/test/test-helper.xqy#L821
deprecate each of the functions https://github.com/marklogic-community/marklogic-unit-test/blob/63a8aa4a36d1d2576469a8972ec91960b204a980/marklogic-unit-test-modules/src/main/ml-modules/root/test/test-helper.xqy#L826
deprecate each of the functions https://github.com/marklogic-community/marklogic-unit-test/blob/63a8aa4a36d1d2576469a8972ec91960b204a980/marklogic-unit-test-modules/src/main/ml-modules/root/test/test-helper.xqy#L831
deprecate each of the functions https://github.com/marklogic-community/marklogic-unit-test/blob/63a8aa4a36d1d2576469a8972ec91960b204a980/marklogic-unit-test-modules/src/main/ml-modules/root/test/test-helper.xqy#L836
deprecate each of the functions https://github.com/marklogic-community/marklogic-unit-test/blob/63a8aa4a36d1d2576469a8972ec91960b204a980/marklogic-unit-test-modules/src/main/ml-modules/root/test/test-helper.xqy#L841
deprecate each of the functions https://github.com/marklogic-community/marklogic-unit-test/blob/63a8aa4a36d1d2576469a8972ec91960b204a980/marklogic-unit-test-modules/src/main/ml-modules/root/test/test-helper.xqy#L846
We should discourage an unbounded number of parameters being passed in the middle of a function with optional parameters at the end. With newer versions of MarkLogic we have support for anonymous functions, and should encourage the use of anonymous functions to invoke arbitrary code that is expected to throw an error.
Instead of passing in the method reference, and parameters as follows:
Tests should be written to use anonymous functions to invoke the code that is expected to error:
Using the anonymous function has a few advantages including working around our current implementation that will break if more than 7 parameters are passed into the
assert-throws-error
function. It also simplifies the implementation inside test-helper by removing many overloaded functions, and relatively messy implementation at https://github.com/marklogic-community/marklogic-unit-test/blob/63a8aa4a36d1d2576469a8972ec91960b204a980/marklogic-unit-test-modules/src/main/ml-modules/root/test/test-helper.xqy#L850The existing functions should be left in place for now, and we should log an info level message letting the client know that the methods are deprecated and will be removed in a future release.