### Question:
DistanceSensorImpl implements DistanceSensor { @Override public double getDistance() { return currentSensorValue; } DistanceSensorImpl(CommunicationsMediator communicationsMediator,
                       ArduinoCommunicator arduinoCommunicator,
                       Filter filter); @Override double getDistance(); @Override double getValue(); @Override void subscribe(Consumer<Double> dataConsumer); @Override void unsubscribe(Consumer<Double> dataConsumer);  }### Answer:
@Test void getDistance(){ sensorInstance.receivedString("1.0\n",new StringBuilder()); assertEquals(0.7,sensorInstance.getDistance(), 0.01); }
@Test void testRecieveData() { CommunicationsMediator cm = new CommunicationsMediator() { private DataReceiver distanceSensor; @Override public void transmitData(String data, Direction direction) { distanceSensor.dataReceived(data); } @Override public void subscribe(Direction direction, DataReceiver receiver) { distanceSensor = receiver; } @Override public void unsubscribe(Direction direction, DataReceiver receiver) { } }; DistanceSensor ds = new DistanceSensorImpl(cm, ardMock, new LowPassFilter(LP_WEIGHT)); cm.transmitData(CAM_TGT_DIST + ",1.0\n", Direction.INTERNAL); assertEquals(0.7, ds.getDistance(),0.01); }