### Question:
HashCodeHelper { public static int getHashCodeNoNulls(int startHash, int prime, Object... objects) { int result = startHash; for (Object obj : objects) { result = prime * result + obj.hashCode(); } return result; } private  HashCodeHelper(); static int getHashCode(boolean val); static int getHashCode(byte val); static int getHashCode(double val); static int getHashCode(float val); static int getHashCode(int val); static int getHashCode(int startHash, int prime, Object... objects); static int getHashCode(long val); static int getHashCode(Object o); @SuppressWarnings("PMD.AvoidUsingShortType") static int getHashCode(short val); static int getHashCodeNoNulls(int startHash, int prime, Object... objects);  }### Answer:
@Test public void testGetHashCodeNoNulls() { Object o1 = new HashCodeObject(67); Object o2 = new HashCodeObject(0); Object o3 = new HashCodeObject(111); int startHash = 37; int prime = 31; Assert.assertEquals(startHash, HashCodeHelper.getHashCode(startHash, prime)); Assert.assertEquals(1214, HashCodeHelper.getHashCode(startHash, prime, o1)); Assert.assertEquals(1147, HashCodeHelper.getHashCode(startHash, prime, o2)); Assert.assertEquals(37634, HashCodeHelper.getHashCode(startHash, prime, o1, o2)); Assert.assertEquals(1166765, HashCodeHelper.getHashCode(startHash, prime, o1, o2, o3)); }
@Test(expected = NullPointerException.class) public void testGetHashCodeNoNullsWithNull() { int startHash = 37; int prime = 31; HashCodeHelper.getHashCodeNoNulls(startHash, prime, (Object)null); }