[BACKLOG-452] -- refactored getJobState and added unit tests for it