### Question:
MainnetBlockImporter implements BlockImporter { @Override public synchronized boolean importBlock( final ProtocolContext context, final Block block, final HeaderValidationMode headerValidationMode, final HeaderValidationMode ommerValidationMode) { if (context.getBlockchain().contains(block.getHash())) { return true; } final Optional<BlockValidator.BlockProcessingOutputs> outputs = blockValidator.validateAndProcessBlock( context, block, headerValidationMode, ommerValidationMode); outputs.ifPresent( processingOutputs -> context.getBlockchain().appendBlock(block, processingOutputs.receipts)); return outputs.isPresent(); } MainnetBlockImporter(final BlockValidator blockValidator); @Override synchronized boolean importBlock(
      final ProtocolContext context,
      final Block block,
      final HeaderValidationMode headerValidationMode,
      final HeaderValidationMode ommerValidationMode); @Override boolean fastImportBlock(
      final ProtocolContext context,
      final Block block,
      final List<TransactionReceipt> receipts,
      final HeaderValidationMode headerValidationMode,
      final HeaderValidationMode ommerValidationMode);  }### Answer:
@Test public void doNotImportBlockIfBlockchainAlreadyHasBlock() { when(blockchain.contains(hash)).thenReturn(true); assertThat( blockImporter.importBlock( context, block, HeaderValidationMode.FULL, HeaderValidationMode.FULL)) .isTrue(); verify(blockValidator, never()) .validateAndProcessBlock( context, block, HeaderValidationMode.FULL, HeaderValidationMode.FULL); verify(blockchain, never()).appendBlock(eq(block), any()); }