@Override
    public int hashCode() {
        return Objects.hash(partition, topicId);
    }
@Test
    public void testCachedSharePartitionEqualsAndHashCode() {
        Uuid topicId = Uuid.randomUuid();
        String topicName = "topic";
        int partition = 0;

        CachedSharePartition cachedSharePartitionWithIdAndName = new
                CachedSharePartition(topicName, topicId, partition, false);
        CachedSharePartition cachedSharePartitionWithIdAndNoName = new
                CachedSharePartition(null, topicId, partition, false);
        CachedSharePartition cachedSharePartitionWithDifferentIdAndName = new
                CachedSharePartition(topicName, Uuid.randomUuid(), partition, false);
        CachedSharePartition cachedSharePartitionWithZeroIdAndName = new
                CachedSharePartition(topicName, Uuid.ZERO_UUID, partition, false);

        // CachedSharePartitions with valid topic IDs will compare topic ID and partition but not topic name.
        assertEquals(cachedSharePartitionWithIdAndName, cachedSharePartitionWithIdAndNoName);
        assertEquals(cachedSharePartitionWithIdAndName.hashCode(), cachedSharePartitionWithIdAndNoName.hashCode());

        assertNotEquals(cachedSharePartitionWithIdAndName, cachedSharePartitionWithDifferentIdAndName);
        assertNotEquals(cachedSharePartitionWithIdAndName.hashCode(), cachedSharePartitionWithDifferentIdAndName.hashCode());

        assertNotEquals(cachedSharePartitionWithIdAndName, cachedSharePartitionWithZeroIdAndName);
        assertNotEquals(cachedSharePartitionWithIdAndName.hashCode(), cachedSharePartitionWithZeroIdAndName.hashCode());

        // CachedSharePartitions with null name and valid IDs will act just like ones with valid names

        assertNotEquals(cachedSharePartitionWithIdAndNoName, cachedSharePartitionWithDifferentIdAndName);
        assertNotEquals(cachedSharePartitionWithIdAndNoName.hashCode(), cachedSharePartitionWithDifferentIdAndName.hashCode());

        assertNotEquals(cachedSharePartitionWithIdAndNoName, cachedSharePartitionWithZeroIdAndName);
        assertNotEquals(cachedSharePartitionWithIdAndNoName.hashCode(), cachedSharePartitionWithZeroIdAndName.hashCode());

        assertEquals(cachedSharePartitionWithZeroIdAndName.hashCode(), cachedSharePartitionWithZeroIdAndName.hashCode());
    }