[T] Replace static var in tests with an outer def.

Running this test multiple times using `--gtest_repeat` caused an error because of the `static` modifier.

I would suggest not to use `static` in tests, because the state of the test depends on execution order.