Refactors tests to work around IntelliJ IDEA build issues
This closes #166