Use the same way of assert isinstance in all tests

Change-Id: Ia0b0c2875183ccb588cebd480a4fcda7114915f2
Proper exception raised from check_task_transition

* Used proper exception (InvalidStateException -> InvalidState) in
  the check_task_transition function.
* Added unit tests for the check_task_transition function.

Change-Id: I093c209ed77c69739ab92dd1426da6a94e8bd81a
Merge "Use the same way of assert isinstance in all tests"
Merge "Proper exception raised from check_task_transition"