[WFLY-2879] - Remove duplicated code from test cases where custom module...

...s are needed.

This was originally https://github.com/wildfly/wildfly/pull/6577 but it appears that got closed rather than merged. I noticed this when doing https://github.com/jbossas/jboss-eap/pull/1629 which then showed that this work was not part of upstream.
I think you need to also package this class up in the test archive