add null checks in getTemplate to fail fast
added assertion texts in tests, formatting