diff --git a/hiero-enterprise-base/pom.xml b/hiero-enterprise-base/pom.xml
index 2a4c848..a1feac3 100644
--- a/hiero-enterprise-base/pom.xml
+++ b/hiero-enterprise-base/pom.xml
@@ -45,7 +45,6 @@
org.mockito
mockito-core
- 5.11.0
test
diff --git a/hiero-enterprise-base/src/main/java/com/openelements/hiero/base/implementation/AccountClientImpl.java b/hiero-enterprise-base/src/main/java/com/openelements/hiero/base/implementation/AccountClientImpl.java
index c375e7c..7ddb646 100644
--- a/hiero-enterprise-base/src/main/java/com/openelements/hiero/base/implementation/AccountClientImpl.java
+++ b/hiero-enterprise-base/src/main/java/com/openelements/hiero/base/implementation/AccountClientImpl.java
@@ -1,4 +1,5 @@
package com.openelements.hiero.base.implementation;
+import com.hedera.hashgraph.sdk.AccountId;
import com.hedera.hashgraph.sdk.Hbar;
import com.openelements.hiero.base.data.Account;
import com.openelements.hiero.base.AccountClient;
@@ -42,7 +43,7 @@ public void deleteAccount(@NonNull Account account, @NonNull Account toAccount)
@NonNull
@Override
- public Hbar getAccountBalance(com.hedera.hashgraph.sdk.AccountId account) throws HieroException {
+ public Hbar getAccountBalance(@NonNull AccountId account) throws HieroException {
final AccountBalanceRequest request = AccountBalanceRequest.of(account);
final AccountBalanceResponse response = client.executeAccountBalanceQuery(request);
return response.hbars();
diff --git a/hiero-enterprise-base/src/test/java/com/openelements/hiero/base/test/AccountClientImplTest.java b/hiero-enterprise-base/src/test/java/com/openelements/hiero/base/test/AccountClientImplTest.java
index 11fc2f2..b989842 100644
--- a/hiero-enterprise-base/src/test/java/com/openelements/hiero/base/test/AccountClientImplTest.java
+++ b/hiero-enterprise-base/src/test/java/com/openelements/hiero/base/test/AccountClientImplTest.java
@@ -1,5 +1,7 @@
package com.openelements.hiero.base.test;
+
import com.openelements.hiero.base.implementation.AccountClientImpl;
+import com.hedera.hashgraph.sdk.AccountId;
import com.hedera.hashgraph.sdk.Hbar;
import com.openelements.hiero.base.HieroException;
import com.openelements.hiero.base.protocol.AccountBalanceRequest;
@@ -25,8 +27,7 @@ public void setUp() {
@Test
public void testGetAccountBalance_ValidPositiveBalance() throws HieroException {
- // Fully qualify AccountId to ensure no ambiguity
- com.hedera.hashgraph.sdk.AccountId accountId = com.hedera.hashgraph.sdk.AccountId.fromString("0.0.12345");
+ AccountId accountId = AccountId.fromString("0.0.12345");
Hbar expectedBalance = new Hbar(10);
// Mock the response
@@ -37,7 +38,6 @@ public void testGetAccountBalance_ValidPositiveBalance() throws HieroException {
ArgumentMatchers.any(AccountBalanceRequest.class)
)).thenReturn(mockResponse);
- // Explicit cast ensures we're calling the correct method
Hbar balance = accountClientImpl.getAccountBalance(accountId);
assertEquals(expectedBalance, balance);
@@ -45,7 +45,7 @@ public void testGetAccountBalance_ValidPositiveBalance() throws HieroException {
@Test
public void testGetAccountBalance_ZeroBalance() throws HieroException {
- com.hedera.hashgraph.sdk.AccountId accountId = com.hedera.hashgraph.sdk.AccountId.fromString("0.0.67890");
+ AccountId accountId = AccountId.fromString("0.0.67890");
Hbar expectedBalance = new Hbar(0);
AccountBalanceResponse mockResponse = mock(AccountBalanceResponse.class);
@@ -62,30 +62,27 @@ public void testGetAccountBalance_ZeroBalance() throws HieroException {
@Test
public void testGetAccountBalance_InvalidAccount_ThrowsException() throws HieroException {
- // Use a valid but non-existing account ID to simulate invalid behavior
- com.hedera.hashgraph.sdk.AccountId invalidAccountId = com.hedera.hashgraph.sdk.AccountId.fromString("0.0.9999999"); // Simulate invalid or non-existing account
-
+ AccountId invalidAccountId = AccountId.fromString("0.0.9999999");
+
when(mockProtocolLayerClient.executeAccountBalanceQuery(
ArgumentMatchers.any(AccountBalanceRequest.class)
)).thenThrow(new HieroException("Invalid account"));
-
+
assertThrows(HieroException.class, () -> {
accountClientImpl.getAccountBalance(invalidAccountId);
});
}
-
@Test
public void testGetAccountBalance_NullThrowsException() {
assertThrows(NullPointerException.class, () -> {
- accountClientImpl.getAccountBalance((com.hedera.hashgraph.sdk.AccountId) null);
+ accountClientImpl.getAccountBalance((AccountId) null);
});
}
-
@Test
public void testGetAccountBalance_ProtocolLayerClientFails() throws HieroException {
- com.hedera.hashgraph.sdk.AccountId accountId = com.hedera.hashgraph.sdk.AccountId.fromString("0.0.12345");
+ AccountId accountId = AccountId.fromString("0.0.12345");
when(mockProtocolLayerClient.executeAccountBalanceQuery(
ArgumentMatchers.any(AccountBalanceRequest.class)
diff --git a/pom.xml b/pom.xml
index b4de806..273d22a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -159,9 +159,10 @@
junit-jupiter
${junit.version}
-
+
org.mockito
mockito-core
+ 5.11.0
org.slf4j