Add counter cache test for class_name

Backport test from #14410
Merge pull request #14414 from arthurnn/port_test_cc_41

Add counter cache test for class_name