refactoring: avoid NPE in tests