Example #1
0
  @Test
  public void testEquals() {
    ReserveInfo other = new ReserveInfo();
    for (QueryType type : QueryType.values()) {
      other.setPromotedReserve(type, 1.0);
      assertFalse(reserveInfo.equals(other));

      other = new ReserveInfo();
      other.setRegularReserve(type, 1.0);
      assertFalse(reserveInfo.equals(other));

      assertEquals(reserveInfo, reserveInfo);
      assertFalse(reserveInfo.equals(null));
      assertFalse(reserveInfo.equals(""));

      other = new ReserveInfo();
      assertEquals(reserveInfo.hashCode(), other.hashCode());

      reserveInfo.setPromotedReserve(type, 1.0);
      reserveInfo.setRegularReserve(type, 1.0);

      other.setPromotedReserve(type, 1.0);
      other.setRegularReserve(type, 1.0);
      assertEquals(reserveInfo.hashCode(), other.hashCode());
    }
  }
Example #2
0
 @Test
 public void testRegularReserve() {
   for (QueryType type : QueryType.values()) {
     assertEquals(reserveInfo.getRegularReserve(type), 0.0, 0);
     reserveInfo.setRegularReserve(type, 1.0);
     assertEquals(reserveInfo.getRegularReserve(type), 1.0, 0);
   }
 }