SPARK-2269 Refactor mesos scheduler resourceOffers and add unit test

I see this is used for testing. We should probably add a comment `// Exposed for testing`