Skip to content

[Maintenance]: FunctionUtil has no tests - which they would fail if they existed. #5956

@bubblobill

Description

@bubblobill

Describe the problem

All macro functions rely on the FunctionUtil class, yet the class has no tests to ensure the methods produce reliable and consistent results.

Some of the methods are also used in non-user-function contexts and may receive dodgy parameters.

For example:
For the sequence -0, 1, 2, 3.3, -4, 5.5, 6, and 7.
Java allows the following numerical values; -0, -1L, 2f, -3.3d, -4e0, 5.5e0, 0x00000006, 0b111.

Each of the FunctionUtil.paramAs methods choke on most of these.
Pass them as strings with leading/trailing white-space and they fail even worse.

getAsBoolean(Object o) which clearly states in the JavaDoc "Convert an object into a boolean value. Never returns an error.", throws errors or returns a spurious result for most of these values 0, 1, -2, 3, true, false, " 0", "1 ", " true", "false ".

The improvement you'd like to see

Greater robustitude of FunctionUtil methods.
Tests that stress the methods.
Reliable results.

Expected Benefits

Improved user and dev experience.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

code-maintenanceAdding/editing javadocs, unit tests, formatting.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions