Null pointer avoid in LocatedDeviceImpl class.
New test cases added to DeviceTest class.