To use the test:component
you need to declare the test
namespace, as you've done for all the other namespaces Mule uses. This said, not sure you want to use test
elements in your production code.
One alternative is to use the null-component
that always throws an exception when it receives a message, but this doesn't give you control of the thrown exception.
The other alternative, is to throw any exception you want from a Groovy component.
Bear in mind that exceptions are wrapped by Mule infrastructure: you'll have to use the ExceptionUtils to dig in the stack and find the root cause.