Implement ObjectArena and ArenaRef to solve JNI Global Reference Issue by cherylEnkidu · Pull Request #1176 · firebase/firebase-cpp-sdk

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just get rid of these throwException() and clearExceptionOccurred() helper methods.

throwException() can be replaced by

env.Throw(CreateException(env, "Test Exception"));

and clearExceptionOccurred() can be replaced by

Admittedly, this leads to a tiny bit of code duplciation between test cases but that's acceptable because, IMO, it improves readabililty of the test cases.

See go/tott/598 about "DAMP" tests rather than the "DRY" principle that is common in non-testing code.