I am trying to write a service for testing a class that implements onSensorChanged(SensorEvent event)by passing its data, which I can create as if it came from a sensor. The problem I am facing is that I cannot create my own SensorEvent objects to pass a function because SensorEvent does not have public constructors. I tried to create my own class, which would have the necessary SensorEvent functions and cast it, but since then I found that in order to be able to distinguish it, it had to be a subclass and subclassed it, I would have to have access to the constructor .
Is there any other way to create an object that I can pass in place of a SensorEvent, or is there a better approach to modeling the missing functions?
source
share