Add tests where a tool is defined in a static inner class. Please also enhance the test from #32620 to check the message is correct when an inner class is used.