FunctionMapKey { @Override public int hashCode() { int result = functionName != null ? functionName.hashCode() : 0; result = 31 * result + (bindingParameterTypeName != null ? bindingParameterTypeName.hashCode() : 0); result = 31 * result + (isBindingParameterCollection != null ? isBindingParameterCollection.hashCode() : 0); result = 31 * result + parameterNames.hashCode(); return result; } FunctionMapKey(final FullQualifiedName functionName, final FullQualifiedName bindingParameterTypeName,
      final Boolean isBindingParameterCollection, final List<String> parameterNames); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testHashCodePositive() { FunctionMapKey key = new FunctionMapKey(fqn, null, null, null); FunctionMapKey someKey = new FunctionMapKey(fqn, null, null, null); assertEquals(key.hashCode(), someKey.hashCode()); key = new FunctionMapKey(fqn, null, true, null); someKey = new FunctionMapKey(fqn, null, true, null); assertEquals(key.hashCode(), someKey.hashCode()); key = new FunctionMapKey(fqn, fqnType, true, null); someKey = new FunctionMapKey(fqn, fqnType, true, null); assertEquals(key.hashCode(), someKey.hashCode()); key = new FunctionMapKey(fqn, fqnType, false, null); someKey = new FunctionMapKey(fqn, fqnType, false, null); assertEquals(key.hashCode(), someKey.hashCode()); key = new FunctionMapKey(fqn, fqnType, false, new ArrayList<String>()); someKey = new FunctionMapKey(fqn, fqnType, false, new ArrayList<String>()); assertEquals(key.hashCode(), someKey.hashCode()); List<String> keyList = new ArrayList<String>(); keyList.add("Employee"); List<String> someKeyList = new ArrayList<String>(); someKeyList.add("Employee"); key = new FunctionMapKey(fqn, fqnType, false, keyList); someKey = new FunctionMapKey(fqn, fqnType, false, someKeyList); assertEquals(key.hashCode(), someKey.hashCode()); key = new FunctionMapKey(fqn, null, null, new ArrayList<String>()); someKey = new FunctionMapKey(fqn, null, null, new ArrayList<String>()); assertEquals(key.hashCode(), someKey.hashCode()); keyList = new ArrayList<String>(); keyList.add("Employee"); someKeyList = new ArrayList<String>(); someKeyList.add("Employee"); key = new FunctionMapKey(fqn, null, null, keyList); someKey = new FunctionMapKey(fqn, null, null, someKeyList); assertEquals(key.hashCode(), someKey.hashCode()); keyList = new ArrayList<String>(); keyList.add("Employee"); keyList.add("employee"); someKeyList = new ArrayList<String>(); someKeyList.add("Employee"); someKeyList.add("employee"); key = new FunctionMapKey(fqn, null, null, keyList); someKey = new FunctionMapKey(fqn, null, null, someKeyList); assertEquals(key.hashCode(), someKey.hashCode()); keyList = new ArrayList<String>(); keyList.add("Employee"); keyList.add("Employee2"); someKeyList = new ArrayList<String>(); someKeyList.add("Employee2"); someKeyList.add("Employee"); key = new FunctionMapKey(fqn, null, null, keyList); someKey = new FunctionMapKey(fqn, null, null, someKeyList); assertEquals(key.hashCode(), someKey.hashCode()); }
@Test public void testHashCodeNegative() { FunctionMapKey key = new FunctionMapKey(fqn, null, null, null); FunctionMapKey someKey = new FunctionMapKey(fqn, null, true, null); assertNotSame(key.hashCode(), someKey.hashCode()); key = new FunctionMapKey(fqn, null, true, null); someKey = new FunctionMapKey(fqn, null, false, null); assertNotSame(key.hashCode(), someKey.hashCode()); key = new FunctionMapKey(fqn, fqnType, true, null); someKey = new FunctionMapKey(fqn, null, true, null); assertNotSame(key.hashCode(), someKey.hashCode()); key = new FunctionMapKey(fqn, null, false, null); someKey = new FunctionMapKey(fqn, fqnType, true, null); assertNotSame(key.hashCode(), someKey.hashCode()); key = new FunctionMapKey(fqn, fqnType, false, null); someKey = new FunctionMapKey(fqn, fqnType, false, new ArrayList<String>()); assertNotSame(key.hashCode(), someKey.hashCode()); List<String> keyList = new ArrayList<String>(); keyList.add("Employee"); List<String> someKeyList = new ArrayList<String>(); someKeyList.add("Employee2"); key = new FunctionMapKey(fqn, fqnType, false, keyList); someKey = new FunctionMapKey(fqn, fqnType, false, someKeyList); assertNotSame(key.hashCode(), someKey.hashCode()); key = new FunctionMapKey(fqn, null, null, new ArrayList<String>()); someKey = new FunctionMapKey(fqn, null, null, new ArrayList<String>()); assertNotSame(key.hashCode(), someKey.hashCode()); keyList = new ArrayList<String>(); keyList.add("Employee"); someKeyList = new ArrayList<String>(); someKeyList.add("Employee2"); key = new FunctionMapKey(fqn, null, null, keyList); someKey = new FunctionMapKey(fqn, null, null, someKeyList); assertNotSame(key.hashCode(), someKey.hashCode()); key = new FunctionMapKey(fqn, null, null, new ArrayList<String>()); someKey = new FunctionMapKey(fqn, null, null, null); assertNotSame(key.hashCode(), someKey.hashCode()); }