### Question:
SerialPortParameters { @Override public int hashCode() { int hash = HASH_SEED; hash = hash * (hash + baudrate); hash = hash * (hash + dataBits); hash = hash * (hash + stopBits); hash = hash * (hash + parity); hash = hash * (hash + flowControl); return hash; } SerialPortParameters(int baudrate, int dataBits, int stopBits, int parity, int flowControl); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); final int baudrate; final int dataBits; final int stopBits; final int parity; final int flowControl; }### Answer:
@Test public final void testHashCodeIsConsistent() { SerialPortParameters parameters = new SerialPortParameters(9600, 8, 1, 0, 0); int initialHashCode = parameters.hashCode(); assertThat("Consistent hashcode test fails", parameters.hashCode(), is(equalTo(initialHashCode))); assertThat("Consistent hashcode test fails", parameters.hashCode(), is(equalTo(initialHashCode))); }