Check expected value first for class to be used to perform comparison, since actual value might be wrong.