InterestRateCurveSensitivity { public double totalSensitivity() { double total = 0.0; for (final List<DoublesPair> pairs : _sensitivity.values()) { for (final DoublesPair p : pairs) { total += p.second; } } return total; } InterestRateCurveSensitivity();  InterestRateCurveSensitivity(final Map<String, List<DoublesPair>> sensitivity); static InterestRateCurveSensitivity of(final String name, final List<DoublesPair> sensitivityCurve); Map<String, List<DoublesPair>> getSensitivities(); Set<String> getCurves(); InterestRateCurveSensitivity plus(final InterestRateCurveSensitivity other); InterestRateCurveSensitivity plus(final String curveName, final List<DoublesPair> list); InterestRateCurveSensitivity multipliedBy(final double factor); InterestRateCurveSensitivity cleaned(); InterestRateCurveSensitivity cleaned(final double relTol, final double absTol); Map<String, Double> totalSensitivityByCurve(); double totalSensitivity(); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testTotalSensitivity() { final InterestRateCurveSensitivity sensitivity1 = new InterestRateCurveSensitivity(SENSITIVITY_11); final InterestRateCurveSensitivity sensitivity2 = new InterestRateCurveSensitivity(SENSITIVITY_12); final InterestRateCurveSensitivity sensitivity3 = new InterestRateCurveSensitivity(SENSITIVITY_22); final InterestRateCurveSensitivity sensitivity4 = new InterestRateCurveSensitivity(SENSITIVITY_33); final double actual = sensitivity1.plus(sensitivity2).plus(sensitivity3).plus(sensitivity4).totalSensitivity(); final double expected = 400; assertEquals(expected, actual); }