Error: constant string too long

That’s not a Gradle specific error, but just a limitation of Java. You could simply put your test data in a file and read that in the test instead of putting a huge String into your test class.