IllegalArgumentException test for parametes and code optimization

1. Assertion of parameters number changed to IllegalArgumentException
2. Instead of switch on number of parameters, direct function calls
This eliminates switch based branch prediction.
Good path in test