Migrate 2.3.x branch to JUnit4 (mostly through cherry-picking)

All commits except 2 of the last 3 are cherry-picks. I could have rebased them all in a single commit, but I am afraid of confusing git when we later start doing (new) cherry-picks from master to 2.3.x.