Fixed null pointer error in test