use of com.hedera.services.utils.EntityNumPair in project hedera-services by hashgraph.
the class MerkleTokenRelStatusTest method deserializeWorksForPre0180.
@Test
void deserializeWorksForPre0180() throws IOException {
final var in = mock(SerializableDataInputStream.class);
final var defaultSubject = new MerkleTokenRelStatus();
given(in.readLong()).willReturn(balance);
given(in.readBoolean()).willReturn(frozen).willReturn(kycGranted).willReturn(automaticAssociation);
defaultSubject.deserialize(in, MerkleTokenRelStatus.RELEASE_090_VERSION);
assertNotEquals(subject, defaultSubject);
// and when:
defaultSubject.setKey(new EntityNumPair(numbers));
// then:
assertEquals(subject, defaultSubject);
}
use of com.hedera.services.utils.EntityNumPair in project hedera-services by hashgraph.
the class MerkleTokenRelStatusTest method deserializeWorksFor0180PreSdk.
@Test
void deserializeWorksFor0180PreSdk() throws IOException {
final var in = mock(SerializableDataInputStream.class);
final var defaultSubject = new MerkleTokenRelStatus();
given(in.readLong()).willReturn(balance);
given(in.readBoolean()).willReturn(frozen).willReturn(kycGranted).willReturn(automaticAssociation);
defaultSubject.deserialize(in, MerkleTokenRelStatus.RELEASE_0180_PRE_SDK_VERSION);
// then:
assertNotEquals(subject, defaultSubject);
// and when:
defaultSubject.setKey(new EntityNumPair(numbers));
// then:
assertEquals(subject, defaultSubject);
}
use of com.hedera.services.utils.EntityNumPair in project hedera-services by hashgraph.
the class MerkleUniqueTokenTest method setup.
@BeforeEach
void setup() {
owner = new EntityId(0, 0, 3);
otherOwner = new EntityId(0, 0, 4);
metadata = "Test NFT".getBytes();
otherMetadata = "Test NFT2".getBytes();
timestamp = RichInstant.fromJava(Instant.ofEpochSecond(timestampL));
otherTimestamp = RichInstant.fromJava(Instant.ofEpochSecond(1_234_568L));
subject = new MerkleUniqueToken(owner, metadata, timestamp);
subject.setKey(new EntityNumPair(numbers));
}
use of com.hedera.services.utils.EntityNumPair in project hedera-services by hashgraph.
the class MerkleUniqueTokenTest method hashCodeWorks.
@Test
void hashCodeWorks() {
// given:
var identical = new MerkleUniqueToken(owner, metadata, timestamp);
identical.setKey(new EntityNumPair(numbers));
var other = new MerkleUniqueToken(otherOwner, otherMetadata, otherTimestamp);
// expect:
assertNotEquals(subject.hashCode(), other.hashCode());
assertEquals(subject.hashCode(), identical.hashCode());
}
use of com.hedera.services.utils.EntityNumPair in project hedera-services by hashgraph.
the class MerkleUniqueTokenTest method deserializeWorksPre0180.
@Test
void deserializeWorksPre0180() throws IOException {
// setup:
SerializableDataInputStream in = mock(SerializableDataInputStream.class);
// and:
final var packedTime = packedTime(timestamp.getSeconds(), timestamp.getNanos());
given(in.readByteArray(anyInt())).willReturn(metadata);
given(in.readLong()).willReturn(packedTime);
given(in.readInt()).willReturn(owner.identityCode());
// and:
var read = new MerkleUniqueToken();
// when:
read.deserialize(in, MerkleUniqueToken.PRE_RELEASE_0180_VERSION);
// then:
assertNotEquals(subject, read);
// and when:
read.setKey(new EntityNumPair(numbers));
// then:
assertEquals(subject, read);
}
Aggregations