Narrow the return types to API types in tests.

This should drastically reduce the number of internal “hits” in plugins.
@dragos: Not related to this PR in particular, but I have a question - what's your view on imports optimization? Because every time I rebase on top of new master I have a ton of conflicts and most of them are just imports added in different order.