### Question:
ChainHead extends SignedBlockAndState { public static ChainHead create(SignedBlockAndState blockAndState, UInt64 forkChoiceSlot) { return new ChainHead(blockAndState.getBlock(), blockAndState.getState(), forkChoiceSlot); } ChainHead(SignedBeaconBlock block, BeaconState state, UInt64 forkChoiceSlot); static ChainHead create(SignedBlockAndState blockAndState, UInt64 forkChoiceSlot); UInt64 getForkChoiceSlot(); UInt64 findCommonAncestor(final ChainHead other); @Override boolean equals(final Object o); @Override int hashCode();  }### Answer:
@Test public void equals_shouldBeEqualToCopy() { final SignedBlockAndState block = dataStructureUtil.randomSignedBlockAndState(UInt64.ONE); final UInt64 forkChoiceSlot = UInt64.valueOf(1L); final ChainHead chainHead = ChainHead.create(block, forkChoiceSlot); final ChainHead otherChainHead = copy(chainHead); assertThat(chainHead).isEqualTo(otherChainHead); }
@Test public void equals_shouldBNotBeEqualWhenForkChoiceSlotDiffers() { final SignedBlockAndState block = dataStructureUtil.randomSignedBlockAndState(UInt64.ONE); final UInt64 forkChoiceSlot = UInt64.valueOf(1L); final ChainHead chainHead = ChainHead.create(block, forkChoiceSlot); final ChainHead otherChainHead = ChainHead.create(chainHead, forkChoiceSlot.plus(1)); assertThat(chainHead).isNotEqualTo(otherChainHead); }
@Test public void equals_shouldBNotBeEqualWhenBlocksDiffer() { final SignedBlockAndState block = dataStructureUtil.randomSignedBlockAndState(UInt64.ONE); final SignedBlockAndState otherBlock = dataStructureUtil.randomSignedBlockAndState(UInt64.ONE); assertThat(block).isNotEqualTo(otherBlock); final UInt64 forkChoiceSlot = UInt64.valueOf(1L); final ChainHead chainHead = ChainHead.create(block, forkChoiceSlot); final ChainHead otherChainHead = ChainHead.create(otherBlock, forkChoiceSlot); assertThat(chainHead).isNotEqualTo(otherChainHead); }