code & unit test for spark context hang detection logic

() is unnecessary if case class has no class members.