### Question:
SignedDataValidator { public boolean validateProposal(final SignedData<ProposalPayload> msg) { if (proposal.isPresent()) { return handleSubsequentProposal(proposal.get(), msg); } if (!validateProposalSignedDataPayload(msg)) { return false; } proposal = Optional.of(msg); return true; } SignedDataValidator(
      final Collection<Address> validators,
      final Address expectedProposer,
      final ConsensusRoundIdentifier roundIdentifier); boolean validateProposal(final SignedData<ProposalPayload> msg); boolean validatePrepare(final SignedData<PreparePayload> msg); boolean validateCommit(final SignedData<CommitPayload> msg);  }### Answer:
@Test public void receivingProposalMessageFromNonProposerFails() { final Block block = TestHelpers.createProposalBlock(emptyList(), roundIdentifier); final Proposal proposalMsg = validatorMessageFactory.createProposal(roundIdentifier, block, Optional.empty()); assertThat(validator.validateProposal(proposalMsg.getSignedPayload())).isFalse(); }
@Test public void subsequentProposalHasDifferentSenderFails() { final Proposal proposalMsg = proposerMessageFactory.createProposal(roundIdentifier, block, Optional.empty()); assertThat(validator.validateProposal(proposalMsg.getSignedPayload())).isTrue(); final Proposal secondProposalMsg = validatorMessageFactory.createProposal(roundIdentifier, block, Optional.empty()); assertThat(validator.validateProposal(secondProposalMsg.getSignedPayload())).isFalse(); }
@Test public void subsequentProposalHasDifferentContentFails() { final Proposal proposalMsg = proposerMessageFactory.createProposal(roundIdentifier, block, Optional.empty()); assertThat(validator.validateProposal(proposalMsg.getSignedPayload())).isTrue(); final ConsensusRoundIdentifier newRoundIdentifier = new ConsensusRoundIdentifier(3, 0); final Proposal secondProposalMsg = proposerMessageFactory.createProposal(newRoundIdentifier, block, Optional.empty()); assertThat(validator.validateProposal(secondProposalMsg.getSignedPayload())).isFalse(); }
@Test public void subsequentProposalHasIdenticalSenderAndContentIsSuccessful() { final Proposal proposalMsg = proposerMessageFactory.createProposal(roundIdentifier, block, Optional.empty()); assertThat(validator.validateProposal(proposalMsg.getSignedPayload())).isTrue(); final Proposal secondProposalMsg = proposerMessageFactory.createProposal(roundIdentifier, block, Optional.empty()); assertThat(validator.validateProposal(secondProposalMsg.getSignedPayload())).isTrue(); }