### Question:
ForwardIborAveragedRateComputationFn implements RateComputationFn<IborAveragedRateComputation> { @Override public PointSensitivityBuilder rateSensitivity( IborAveragedRateComputation computation, LocalDate startDate, LocalDate endDate, RatesProvider provider) { IborIndexRates rates = provider.iborIndexRates(computation.getIndex()); return computation.getFixings().stream() .filter(fixing -> !fixing.getFixedRate().isPresent()) .map(fixing -> weightedSensitivity(fixing, computation.getTotalWeight(), rates)) .reduce(PointSensitivityBuilder.none(), PointSensitivityBuilder::combinedWith); } ForwardIborAveragedRateComputationFn(); @Override double rate(
      IborAveragedRateComputation computation,
      LocalDate startDate,
      LocalDate endDate,
      RatesProvider provider); @Override PointSensitivityBuilder rateSensitivity(
      IborAveragedRateComputation computation,
      LocalDate startDate,
      LocalDate endDate,
      RatesProvider provider); @Override double explainRate(
      IborAveragedRateComputation computation,
      LocalDate startDate,
      LocalDate endDate,
      RatesProvider provider,
      ExplainMapBuilder builder); static final ForwardIborAveragedRateComputationFn DEFAULT; }### Answer:
@Test public void test_rateSensitivity() { IborIndexRates mockIbor = mock(IborIndexRates.class); SimpleRatesProvider prov = new SimpleRatesProvider(); prov.setIborRates(mockIbor); List<IborAveragedFixing> fixings = new ArrayList<>(); double totalWeight = 0.0d; for (int i = 0; i < OBSERVATIONS.length; i++) { IborIndexObservation obs = OBSERVATIONS[i]; IborAveragedFixing fixing = IborAveragedFixing.builder() .observation(obs) .weight(WEIGHTS[i]) .build(); fixings.add(fixing); totalWeight += WEIGHTS[i]; when(mockIbor.ratePointSensitivity(obs)).thenReturn(SENSITIVITIES[i]); } PointSensitivities expected = PointSensitivities.of(ImmutableList.of( IborRateSensitivity.of(OBSERVATIONS[0], WEIGHTS[0] / totalWeight), IborRateSensitivity.of(OBSERVATIONS[1], WEIGHTS[1] / totalWeight), IborRateSensitivity.of(OBSERVATIONS[2], WEIGHTS[2] / totalWeight), IborRateSensitivity.of(OBSERVATIONS[3], WEIGHTS[3] / totalWeight))); IborAveragedRateComputation ro = IborAveragedRateComputation.of(fixings); ForwardIborAveragedRateComputationFn obsFn = ForwardIborAveragedRateComputationFn.DEFAULT; PointSensitivityBuilder test = obsFn.rateSensitivity(ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE, prov); assertThat(test.build()).isEqualTo(expected); }