### Question:
BeaconDistanceCalculator { public static float calculateDistance(float rssi, float calibratedRssi, int calibratedDistance, float pathLossParameter) { return calculateDistance(rssi, getCalibratedRssiAtOneMeter(calibratedRssi, calibratedDistance), pathLossParameter); }  static float calculateDistanceTo(Beacon beacon); static float calculateDistanceWithoutElevationDeltaToDevice(Beacon beacon, float rssi, double deviceElevation); static float calculateDistanceTo(Beacon beacon, float rssi); static float calculateDistance(float rssi, float calibratedRssi, int calibratedDistance, float pathLossParameter); static float getCalibratedRssiAtOneMeter(float calibratedRssi, float calibratedDistance); static float calculateDistance(float rssi, float calibratedRssi, float pathLossParameter); static void setPathLossParameter(float pathLossParameter); static float getPathLossParameter(); static final float PATH_LOSS_PARAMETER_OPEN_SPACE; static final float PATH_LOSS_PARAMETER_INDOOR; static final float PATH_LOSS_PARAMETER_OFFICE_HARD_PARTITION; static final int CALIBRATED_RSSI_AT_ONE_METER; static final int SIGNAL_LOSS_AT_ONE_METER; }### Answer:
@Test public void calculateDistance() throws Exception { int rssiAtZeroMeters = -45; int rssiAtOneMeter = -65; float calculatedDistance = BeaconDistanceCalculator.calculateDistance(-80, rssiAtOneMeter, BeaconDistanceCalculator.PATH_LOSS_PARAMETER_INDOOR); assertEquals(8, calculatedDistance, 1); calculatedDistance = BeaconDistanceCalculator.calculateDistance(-100, rssiAtOneMeter, BeaconDistanceCalculator.PATH_LOSS_PARAMETER_INDOOR); assertEquals(110, calculatedDistance, 10); }
@Test public void calculateDistance_calibratedRssi_calibratedDistance() throws Exception { int rssiAtZeroMeters = -45; int rssiAtOneMeter = -65; float calculatedDistance = BeaconDistanceCalculator.calculateDistance(rssiAtZeroMeters, rssiAtOneMeter, BeaconDistanceCalculator.PATH_LOSS_PARAMETER_INDOOR); assertEquals(0, calculatedDistance, 0.1); calculatedDistance = BeaconDistanceCalculator.calculateDistance(rssiAtOneMeter, rssiAtOneMeter, BeaconDistanceCalculator.PATH_LOSS_PARAMETER_INDOOR); assertEquals(1, calculatedDistance, 0.1); }