### Question:
LoginSession { @Override public int hashCode() { return Objects.hash(configDirectory, principalName, keytabPath, kerberosMinMillisBeforeRelogin); } LoginSession(String configDirectory);  LoginSession(String configDirectory, UserGroupInformation loginUser);  LoginSession(String configDirectory, String principalName, String keytabPath, long kerberosMinMillisBeforeRelogin);  LoginSession(String configDirectory, String principalName, String keytabPath, UserGroupInformation loginUser,
                        Subject subject, long kerberosMinMillisBeforeRelogin); UserGroupInformation getLoginUser(); long getKerberosMinMillisBeforeRelogin(); Subject getSubject(); User getUser(); String getKeytabPath(); String getPrincipalName(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testEquality() { sessionFoo = new LoginSession("config", "principal", "keytab", ugiFoo, subjectFoo, 1); sessionBar = new LoginSession("config", "principal", "keytab", ugiBar, subjectBar, 1); assertEquals(sessionFoo, sessionBar); assertEquals(sessionFoo.hashCode(), sessionBar.hashCode()); sessionBar = new LoginSession("DIFFERENT", "principal", "keytab", ugiBar, subjectBar, 1); assertNotEquals(sessionFoo, sessionBar); assertNotEquals(sessionFoo.hashCode(), sessionBar.hashCode()); sessionBar = new LoginSession("config", "DIFFERENT", "keytab", ugiBar, subjectBar, 1); assertNotEquals(sessionFoo, sessionBar); assertNotEquals(sessionFoo.hashCode(), sessionBar.hashCode()); sessionBar = new LoginSession("config", "principal", "DIFFERENT", ugiBar, subjectBar, 1); assertNotEquals(sessionFoo, sessionBar); assertNotEquals(sessionFoo.hashCode(), sessionBar.hashCode()); sessionBar = new LoginSession("config", "principal", "keytab", ugiBar, subjectBar, 999); assertNotEquals(sessionFoo, sessionBar); assertNotEquals(sessionFoo.hashCode(), sessionBar.hashCode()); }