Unit test fix in TypeFactory
Added additional checks in ChangeNotificationWrapper to prevent cast exceptions