Search in sources :

Example 6 with EntityNumPair

use of com.hedera.services.utils.EntityNumPair in project hedera-services by hashgraph.

the class MerkleUniqueTokenTest method equalsContractWorks.

@Test
void equalsContractWorks() {
    // setup:
    final var key = new EntityNumPair(numbers);
    // given
    var other = new MerkleUniqueToken(owner, metadata, otherTimestamp);
    other.setKey(key);
    var other2 = new MerkleUniqueToken(owner, otherMetadata, timestamp);
    other2.setKey(key);
    var other3 = new MerkleUniqueToken(otherOwner, metadata, timestamp);
    other3.setKey(key);
    var other4 = new MerkleUniqueToken(owner, metadata, timestamp);
    other4.setKey(new EntityNumPair(numbers + 1));
    var identical = new MerkleUniqueToken(owner, metadata, timestamp);
    identical.setKey(key);
    // expect
    assertNotEquals(subject, new Object());
    assertNotEquals(subject, other);
    assertNotEquals(subject, other2);
    assertNotEquals(subject, other3);
    assertNotEquals(subject, other4);
    assertEquals(subject, identical);
}
Also used : EntityNumPair(com.hedera.services.utils.EntityNumPair) Test(org.junit.jupiter.api.Test)

Aggregations

EntityNumPair (com.hedera.services.utils.EntityNumPair)6 Test (org.junit.jupiter.api.Test)5 EntityId (com.hedera.services.state.submerkle.EntityId)1 SerializableDataInputStream (com.swirlds.common.io.SerializableDataInputStream)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1