use of com.hedera.services.store.models.TokenRelationship in project hedera-services by hashgraph.
the class MintLogicTest method followsUniqueHappyPath.
@Test
void followsUniqueHappyPath() {
// setup:
final long curTotal = 99L;
final long acceptableTotal = 100L;
treasuryRel = new TokenRelationship(token, treasury);
givenValidUniqueTxnCtx();
given(accessor.getTxn()).willReturn(tokenMintTxn);
given(txnCtx.accessor()).willReturn(accessor);
given(token.getTreasury()).willReturn(treasury);
given(store.loadToken(id)).willReturn(token);
given(token.getId()).willReturn(id);
given(store.loadTokenRelationship(token, treasury)).willReturn(treasuryRel);
given(token.getType()).willReturn(TokenType.NON_FUNGIBLE_UNIQUE);
given(store.currentMintedNfts()).willReturn(curTotal);
given(validator.isPermissibleTotalNfts(acceptableTotal)).willReturn(true);
// when:
subject.mint(token.getId(), txnCtx.accessor().getTxn().getTokenMint().getMetadataCount(), txnCtx.accessor().getTxn().getTokenMint().getAmount(), txnCtx.accessor().getTxn().getTokenMint().getMetadataList(), Instant.now());
// then:
verify(token).mint(any(OwnershipTracker.class), eq(treasuryRel), any(List.class), any(RichInstant.class));
verify(store).commitToken(token);
verify(store).commitTokenRelationships(List.of(treasuryRel));
verify(store).commitTrackers(any(OwnershipTracker.class));
verify(accountStore).commitAccount(any(Account.class));
}
Aggregations