### Question:
ClaimDtoMapperDecorator implements ClaimDtoMapper { @Override public ClaimDto map(Claim r) { final ClaimDto dto = delegate.map(r); if (dto != null) { dto.setTransactionHash(blockchainEventService.findOne(r.getBlockchainEventId()) .map(BlockchainEventDto::getTransactionHash) .orElse("")); } return dto; }  @Override ClaimDto map(Claim r);  }### Answer:
@Test void map() { final long blockchainEventId = 465L; final Claim claim = Claim.builder().blockchainEventId(blockchainEventId).build(); final String transactionHash = "rqwerwet"; when(delegate.map(claim)).thenReturn(new ClaimDto()); when(blockchainEventService.findOne(blockchainEventId)).thenReturn(Optional.of(BlockchainEventDto.builder().transactionHash(transactionHash).build())); final ClaimDto result = decorator.map(claim); assertThat(result.getTransactionHash()).isEqualTo(transactionHash); }
@Test void map_null() { when(delegate.map(null)).thenReturn(null); final ClaimDto result = decorator.map(null); assertThat(result).isNull(); }
@Test void map_blockchainEventEmpty() { final long blockchainEventId = 465L; final Claim claim = Claim.builder().blockchainEventId(blockchainEventId).build(); when(delegate.map(claim)).thenReturn(new ClaimDto()); when(blockchainEventService.findOne(blockchainEventId)).thenReturn(Optional.empty()); final ClaimDto result = decorator.map(claim); assertThat(result.getTransactionHash()).isEmpty(); }