I am not sure why this is not straightforward or at least already enabled in libgdx but setting up JUnit to compile with gradle is a bit of a complicated procedure.