Use assertCount() instead of calling sizeof() in tests