Added some tests for ApplyStateContext