Example #1
0
 @Override
 public int hashCode() {
   int result = 0;
   result = 31 * result + (which != null ? which.hashCode() : 0);
   result = 31 * result + (first != null ? first.hashCode() : 0);
   result = 31 * result + (second != null ? second.hashCode() : 0);
   return result;
 }
Example #2
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((a == null) ? 0 : a.hashCode());
   result = prime * result + ((b == null) ? 0 : b.hashCode());
   return result;
 }
Example #3
0
 @Override
 public int hashCode() {
   final int prime = 307967729;
   int result = 1;
   result = prime * result + first.hashCode();
   result = prime * result + second.hashCode();
   return result;
 }
Example #4
0
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;

    Pair<?, ?> other = (Pair<?, ?>) obj;
    if (!first.equals(other.first)) return false;
    if (!second.equals(other.second)) return false;
    return true;
  }
Example #5
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof Ref2)) return false;

    Ref2 ref2 = (Ref2) o;

    if (which != null ? !which.equals(ref2.which) : ref2.which != null) return false;
    if (first != null ? !first.equals(ref2.first) : ref2.first != null) return false;
    if (second != null ? !second.equals(ref2.second) : ref2.second != null) return false;

    return true;
  }
 @Test
 public void test() throws Throwable {
   TestMethodInvocation invocation = new TestMethodInvocation();
   CountObj anobj = new CountObj();
   invocation.setThis(anobj);
   Method method = CountObj.class.getDeclaredMethod("count", First.class);
   invocation.setMethod(method);
   invocation.setArguments(new Object[] {new First()});
   Object res = executerInterceptor.invoke(invocation);
   Assert.assertNotNull(res);
   Assert.assertEquals(Long.class, res.getClass());
   long resFirst = (Long) res;
   Assert.assertEquals(0, resFirst);
   // 然后,插入5个
   for (int i = 1; i <= 5; i++) {
     First first = new First();
     first.setName("name" + i);
     template.insert(first);
     long myres = (Long) executerInterceptor.invoke(invocation);
     Assert.assertEquals(i, myres);
   }
 }
Example #7
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (!(obj instanceof Pair)) return false;
   Pair other = (Pair) obj;
   if (a == null) {
     if (other.a != null) return false;
   } else if (!a.equals(other.a)) return false;
   if (b == null) {
     if (other.b != null) return false;
   } else if (!b.equals(other.b)) return false;
   return true;
 }
Example #8
0
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }

    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    final Pair pair = (Pair) o;

    if (first != null ? !first.equals(pair.first) : pair.first != null) {
      return false;
    }

    if (second != null ? !second.equals(pair.second) : pair.second != null) {
      return false;
    }

    return true;
  }