Add tests inspired by Derby bugs.