Ensure that @BeforeClass and @AfterClass methods are called on the same
classloader as @Test methods.

Closes #969.