Skip to content

Add Missing tests functionality of SmartContractClientImpl #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Agaba-derrick
Copy link

This PR adds tests for the SmartContractClientImpl Module, ensuring correctness and robustness of the callContractFunction method under various conditions.
✔️ Covered Scenarios

✅ Successful contract function call with valid contract ID and function name.

✅ Function call without parameters (null or empty).

✅ Exception handling when the protocol layer throws runtime exceptions.

✅ Exception wrapping with appropriate messaging and cause tracking.

✅ Defensive checks for null contract ID and function name inputs using parameterized tests

Issue Solved

Closes #89

Signed-off-by: Agaba Derrick <agabaderrick18@gmail.com>
String functionName = "getValue";

ContractFunctionResult mockFunctionResult = mock(ContractFunctionResult.class);
com.openelements.hiero.base.protocol.data.ContractCallResult mockProtocolResult =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have inline imports?

}

@Test
void CallContractFunction_exceptionThrown() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests in this class does not really test the API or implementation of the project but jsut creates some mock flows without a real impact of the functionallity of the Api. Sorry but this PR can not be merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Module hiero-base miss tests for functionality of SmartContractClientImpl.callContractFunction
2 participants