assertTrue(other.getSensitivities().isEmpty());
}
@Test
public void plus() {
SimpleParameterSensitivity sensitivity1 = new SimpleParameterSensitivity();
sensitivity1 = sensitivity1.plus(NAME_1, SENSITIVITY_1_1);
sensitivity1 = sensitivity1.plus(NAME_1, SENSITIVITY_1_2);
assertEquals("Add same currency, different sensitivities: ", MATRIX.add(SENSITIVITY_1_1, SENSITIVITY_1_2), sensitivity1.getSensitivity(NAME_1));
SimpleParameterSensitivity sensitivity2 = new SimpleParameterSensitivity();
sensitivity2 = sensitivity2.plus(NAME_1, SENSITIVITY_1_1);
sensitivity2 = sensitivity2.plus(sensitivity1);
sensitivity2 = new SimpleParameterSensitivity();
sensitivity2 = sensitivity2.plus(NAME_1, SENSITIVITY_1_1);
sensitivity2 = sensitivity2.plus(sensitivity1);
assertEquals("Add same currency, test sensitivities: ", MATRIX.add(SENSITIVITY_1_1, MATRIX.add(SENSITIVITY_1_1, SENSITIVITY_1_2)), sensitivity2.getSensitivity(NAME_1));
sensitivity2 = sensitivity2.plus(NAME_2, SENSITIVITY_2_1);
assertEquals("Add different currency, test sensitivities of first name: ", SENSITIVITY_2_1, sensitivity2.getSensitivity(NAME_2));
assertEquals("Add different currency, test sensitivities of second name: ", MATRIX.add(SENSITIVITY_1_1, MATRIX.add(SENSITIVITY_1_1, SENSITIVITY_1_2)), sensitivity2.getSensitivity(NAME_1));
sensitivity2 = sensitivity2.plus(NAME_2, SENSITIVITY_2_1);
assertEquals("Test add same sensitivities: ", MATRIX.scale(SENSITIVITY_2_1, 2.0), sensitivity2.getSensitivity(NAME_2));
assertEquals("Test other currency: ", MATRIX.add(SENSITIVITY_1_1, MATRIX.add(SENSITIVITY_1_1, SENSITIVITY_1_2)), sensitivity2.getSensitivity(NAME_1));
sensitivity2 = sensitivity2.plus(NAME_1, SENSITIVITY_1_1);
assertEquals("SimpleParameterSensitivity: plus", MATRIX.scale(SENSITIVITY_2_1, 2.0), sensitivity2.getSensitivity(NAME_2));
SimpleParameterSensitivity sensitivity3 = new SimpleParameterSensitivity();
sensitivity3 = sensitivity3.plus("New name", SENSITIVITY_1_1);
sensitivity3 = sensitivity3.plus(NAME_1, SENSITIVITY_1_1);
SimpleParameterSensitivity sensitivity4 = new SimpleParameterSensitivity();
sensitivity4 = sensitivity4.plus("New name", SENSITIVITY_1_1);
SimpleParameterSensitivity sensitivity5 = new SimpleParameterSensitivity();
sensitivity5 = sensitivity5.plus(NAME_1, SENSITIVITY_1_1);
sensitivity4 = sensitivity4.plus(sensitivity5);
AssertSensivityObjects.assertEquals("SimpleParameterSensitivity: plus", sensitivity3, sensitivity4, TOLERANCE);
}