@Override
    public boolean equals(Object object) {
        if (object instanceof MastershipInfo) {
            MastershipInfo that = (MastershipInfo) object;
            return this.term == that.term
                && Objects.equals(this.master, that.master)
                && Objects.equals(this.roles, that.roles);
        }
        return false;
    }
@Test
    public void testEquals() throws Exception {
        assertEquals(mastershipInfo, mastershipInfo);
        assertNotEquals(mastershipInfo, new MastershipInfo(1, Optional.of(node1), ImmutableMap.of()));
    }