### Question:
IbftCoinbaseValidationRule implements AttachedBlockHeaderValidationRule { @Override public boolean validate( final BlockHeader header, final BlockHeader parent, final ProtocolContext context) { final ValidatorProvider validatorProvider = context .getConsensusState(IbftContext.class) .getVoteTallyCache() .getVoteTallyAfterBlock(parent); final Address proposer = header.getCoinbase(); final Collection<Address> storedValidators = validatorProvider.getValidators(); if (!storedValidators.contains(proposer)) { LOGGER.trace( "Block proposer is not a member of the validators. proposer={}, validators={}", proposer, storedValidators); return false; } return true; }  @Override boolean validate(
      final BlockHeader header, final BlockHeader parent, final ProtocolContext context);  }### Answer:
@Test public void proposerInValidatorListPassesValidation() { final NodeKey proposerNodeKey = NodeKeyUtils.generate(); final Address proposerAddress = Address.extract(Hash.hash(proposerNodeKey.getPublicKey().getEncodedBytes())); final List<Address> validators = Lists.newArrayList(proposerAddress); final List<NodeKey> committers = Lists.newArrayList(proposerNodeKey); final ProtocolContext context = new ProtocolContext(null, null, setupContextWithValidators(validators)); final IbftCoinbaseValidationRule coinbaseValidationRule = new IbftCoinbaseValidationRule(); BlockHeader header = createProposedBlockHeader(proposerNodeKey, validators, committers); assertThat(coinbaseValidationRule.validate(header, null, context)).isTrue(); }
@Test public void proposerNotInValidatorListFailsValidation() { final NodeKey proposerNodeKey = NodeKeyUtils.generate(); final NodeKey otherValidatorNodeKey = NodeKeyUtils.generate(); final Address otherValidatorNodeAddress = Address.extract(Hash.hash(otherValidatorNodeKey.getPublicKey().getEncodedBytes())); final List<Address> validators = Lists.newArrayList(otherValidatorNodeAddress); final List<NodeKey> committers = Lists.newArrayList(otherValidatorNodeKey); final ProtocolContext context = new ProtocolContext(null, null, setupContextWithValidators(validators)); final IbftCoinbaseValidationRule coinbaseValidationRule = new IbftCoinbaseValidationRule(); BlockHeader header = createProposedBlockHeader(proposerNodeKey, validators, committers); assertThat(coinbaseValidationRule.validate(header, null, context)).isFalse(); }