Separating logic from Spark engine-unit testing