I dont know if codacy supports the checkstyle suppressions where we can exclude this rule only for test classes (see). I am asking their support.
The way I solved it for the radiology module, which is not ideal, is excluding the test directorys. This can be done in the codacy UI.
If I am given permission to change settings on codacy I can for now apply the 2. option.