Replace some anonymous classes with lambdas in test suite