Ejemplo n.º 1
0
 @Test
 public void testEqualHash() {
   assertEquals(PRICE_INDEX, PRICE_INDEX);
   IndexPrice indexDuplicate = new IndexPrice("Euro HICP x", CUR, REGION, LAG);
   assertEquals(PRICE_INDEX, indexDuplicate);
   assertEquals(PRICE_INDEX.hashCode(), indexDuplicate.hashCode());
   IndexPrice modified;
   modified = new IndexPrice("xxx", CUR, REGION, LAG);
   assertFalse(PRICE_INDEX.equals(modified));
   modified = new IndexPrice(NAME, Currency.AUD, REGION, LAG);
   assertFalse(PRICE_INDEX.equals(modified));
   modified = new IndexPrice(NAME, CUR, Currency.AUD, LAG);
   assertFalse(PRICE_INDEX.equals(modified));
 }
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = super.hashCode();
   result = prime * result + _indexPrice.hashCode();
   return result;
 }
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = super.hashCode();
   result = prime * result + _couponPerYear;
   result = prime * result + ((_dayCount == null) ? 0 : _dayCount.hashCode());
   result = prime * result + (_isEOM ? 1231 : 1237);
   result = prime * result + _monthLag;
   result = prime * result + ((_priceIndex == null) ? 0 : _priceIndex.hashCode());
   result = prime * result + ((_yieldConvention == null) ? 0 : _yieldConvention.hashCode());
   return result;
 }