Hi,

Testing public APIs is the way to go, I think, yes.

Note that for unit tests the expected values are whatever the methods are currently returning. For instance, if you pass a "null" argument to "wrapStringToArray" and this method currently returns an elephant, then the unit test should verify that the return value is exactly an elephant.

We may want to discuss later on if an elephant is a proper thing to return when sending a "null" argument or not. We may want to throw a NullPointerException instead. But this will then be a breaking change, because BaseUtilities is used at least in 536 other files in the IDE itself. These breaking changes should be submitted in a specific pull-request, and don't really belong to a unit-test pull request.

Hope this helps,
Antonio


[1]
$ grep -lR 'org.openide.util.BaseUtilities' | wc -l
536

El 1/5/22 a las 0:25, Łukasz Bownik escribió:
Ok. So the most sensible thing to do is not to write tests for
"wrapStringToArray" and test "wrapString" instead.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to