shadows/framework/src/main/java/org/robolectric/shadows/ShadowSensorManager.java
public static SensorEvent createSensorEvent(int valueArraySize) {
    checkArgument(valueArraySize > 0);
    ClassParameter<Integer> valueArraySizeParam = new ClassParameter<>(int.class, valueArraySize);
    return ReflectionHelpers.callConstructor(SensorEvent.class, valueArraySizeParam);
  }
public static SensorEvent createSensorEvent(int valueArraySize) {
    checkArgument(valueArraySize > 0);
    ClassParameter<Integer> valueArraySizeParam = new ClassParameter<>(int.class, valueArraySize);
    return ReflectionHelpers.callConstructor(SensorEvent.class, valueArraySizeParam);
  }
Creates a {@link SensorEvent} with the given value array size, which the caller should set
based on the type of {@link Sensor} which is being emulated.

<p>Callers can then specify individual values for the event. For example, for a proximity event
a caller may wish to specify the distance value:

<pre>{@code
event.values[0] = distance;
}</pre>

<p>See {@link SensorEvent#values} for more information about values.