### Question:
QueryParameter { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((expression == null) ? 0 : expression.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } QueryParameter();  QueryParameter(final String name, final String expression); String getName(); void setName(final String name); String getExpression(); void setExpression(final String expression); boolean decode(); void setDecode(final boolean decode); @Override int hashCode(); @Override boolean equals(final Object obj);  }### Answer:
@Test public void testHashCodeAndEquals() { QueryParameter param1 = new QueryParameter("foo", "bar"); QueryParameter param2 = new QueryParameter("foo", "bar"); QueryParameter param3 = new QueryParameter("foo", "bar2"); QueryParameter param4 = new QueryParameter("foo2", "bar"); assertNotSame(param1.hashCode(), param3.hashCode()); assertNotSame(param1.hashCode(), param4.hashCode()); assertNotSame(param3.hashCode(), param4.hashCode()); assertEquals(param1.hashCode(), param2.hashCode()); assertNotSame(param1, param3); assertNotSame(param1, param4); assertNotSame(param3, param4); assertEquals(param1, param2); }