Skip to content

Commit e2c59b8

Browse files
Merge pull request #54 from SaltedTan/add-constructor-tests-TopicDeleteRequest
#45 Add constructor tests for TopicDeleteRequest
2 parents b9d0e1e + 9c14f9d commit e2c59b8

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

hedera-base/src/test/java/com/openelements/hedera/base/test/ProtocolLayerDataCreationTests.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.hedera.hashgraph.sdk.Hbar;
77
import com.hedera.hashgraph.sdk.PrivateKey;
88
import com.hedera.hashgraph.sdk.Status;
9+
import com.hedera.hashgraph.sdk.TopicId;
910
import com.hedera.hashgraph.sdk.TransactionId;
1011
import com.hedera.hashgraph.sdk.ContractFunctionResult;
1112
import com.hedera.hashgraph.sdk.proto.ContractFunctionResultOrBuilder;
@@ -50,6 +51,7 @@
5051
import com.openelements.hedera.base.protocol.FileDeleteRequest;
5152
import com.openelements.hedera.base.protocol.FileCreateRequest;
5253
import com.openelements.hedera.base.protocol.TopicSubmitMessageResult;
54+
import com.openelements.hedera.base.protocol.TopicDeleteRequest;
5355
import com.openelements.hedera.base.protocol.TopicCreateRequest;
5456

5557
import java.lang.reflect.Constructor;
@@ -743,7 +745,28 @@ void testTopicSubmitMessageResultCreation() {
743745
}
744746

745747
@Test
746-
void testTopicCreateResultCreation() {
748+
void testTopicDeleteRequestCreation() {
749+
//given
750+
final Hbar maxTransactionFee = Hbar.fromTinybars(1000);
751+
final Duration transactionValidDuration = Duration.ofSeconds(10);
752+
final String topicIdString = "0.0.12345";
753+
final TopicId topicId = TopicId.fromString(topicIdString);
754+
755+
//then
756+
Assertions.assertDoesNotThrow(() -> TopicDeleteRequest.of(topicId));
757+
Assertions.assertDoesNotThrow(() -> new TopicDeleteRequest(maxTransactionFee, transactionValidDuration, topicId));
758+
Assertions.assertDoesNotThrow(() -> new TopicDeleteRequest(null, transactionValidDuration, topicId));
759+
Assertions.assertDoesNotThrow(() -> new TopicDeleteRequest(maxTransactionFee, null, topicId));
760+
Assertions.assertDoesNotThrow(() -> new TopicDeleteRequest(null, null, topicId));
761+
Assertions.assertThrows(NullPointerException.class, () -> TopicDeleteRequest.of(null));
762+
Assertions.assertThrows(NullPointerException.class, () -> new TopicDeleteRequest(maxTransactionFee, transactionValidDuration, null));
763+
Assertions.assertThrows(NullPointerException.class, () -> new TopicDeleteRequest(null, transactionValidDuration, null));
764+
Assertions.assertThrows(NullPointerException.class, () -> new TopicDeleteRequest(maxTransactionFee, null, null));
765+
Assertions.assertThrows(NullPointerException.class, () -> new TopicDeleteRequest(null, null, null));
766+
}
767+
768+
@Test
769+
void testTopicCreateResultCreation() {
747770
//given
748771
final TransactionId validTransactionId = TransactionId.fromString("[email protected]");
749772
final Status validStatus =Status.SUCCESS;

0 commit comments

Comments
 (0)