Add tests and refactor job class

Dynamically generate status predicate methods.
fix errors
add tests