### Question:
DepositsFromBlockEvent { public static DepositsFromBlockEvent create( final UInt64 blockNumber, final Bytes32 blockHash, final UInt64 blockTimestamp, final Stream<Deposit> deposits) { final List<Deposit> sortedDeposits = deposits.sorted(Comparator.comparing(Deposit::getMerkle_tree_index)).collect(toList()); return new DepositsFromBlockEvent(blockNumber, blockHash, blockTimestamp, sortedDeposits); } protected  DepositsFromBlockEvent(
      final UInt64 blockNumber,
      final Bytes32 blockHash,
      final UInt64 blockTimestamp,
      final List<Deposit> deposits); static DepositsFromBlockEvent create(
      final UInt64 blockNumber,
      final Bytes32 blockHash,
      final UInt64 blockTimestamp,
      final Stream<Deposit> deposits); UInt64 getFirstDepositIndex(); UInt64 getLastDepositIndex(); UInt64 getBlockNumber(); Bytes32 getBlockHash(); UInt64 getBlockTimestamp(); List<Deposit> getDeposits(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void create_withMissingDeposit() { final Deposit deposit1 = dataStructureUtil.randomDepositEvent(1); final Deposit deposit3 = dataStructureUtil.randomDepositEvent(3); final Stream<Deposit> depositStream = Stream.of(deposit3, deposit1); assertThatThrownBy( () -> DepositsFromBlockEvent.create( UInt64.ONE, dataStructureUtil.randomBytes32(), UInt64.ONE, depositStream)) .isInstanceOf(InvalidDepositEventsException.class) .hasMessageContaining( "Deposits must be ordered and contiguous. Deposit at index 3 does not follow prior deposit at index 1"); }
@Test public void create_withMissingDepositAtEndOfList() { final Stream<Deposit> depositStream = Stream.of( dataStructureUtil.randomDepositEvent(4), dataStructureUtil.randomDepositEvent(3), dataStructureUtil.randomDepositEvent(5), dataStructureUtil.randomDepositEvent(7)); assertThatThrownBy( () -> DepositsFromBlockEvent.create( UInt64.ONE, dataStructureUtil.randomBytes32(), UInt64.ONE, depositStream)) .isInstanceOf(InvalidDepositEventsException.class) .hasMessageContaining( "Deposits must be ordered and contiguous. Deposit at index 7 does not follow prior deposit at index 5"); }
@Test public void create_withDuplicateDeposit() { final Deposit deposit1 = dataStructureUtil.randomDepositEvent(1); final Stream<Deposit> depositStream = Stream.of(deposit1, deposit1); assertThatThrownBy( () -> DepositsFromBlockEvent.create( UInt64.ONE, dataStructureUtil.randomBytes32(), UInt64.ONE, depositStream)) .isInstanceOf(InvalidDepositEventsException.class) .hasMessageContaining( "Deposits must be ordered and contiguous. Deposit at index 1 does not follow prior deposit at index 1"); }