55import com .openelements .hiero .base .data .Account ;
66import com .hedera .hashgraph .sdk .Hbar ;
77import com .openelements .hiero .base .HieroException ;
8- import com .openelements .hiero .base .protocol .data .AccountBalanceRequest ;
9- import com .openelements .hiero .base .protocol .data .AccountBalanceResponse ;
10- import com .openelements .hiero .base .protocol .data .AccountCreateRequest ;
11- import com .openelements .hiero .base .protocol .data .AccountCreateResult ;
8+ import com .openelements .hiero .base .protocol .data .*;
129import com .openelements .hiero .base .protocol .ProtocolLayerClient ;
1310import org .junit .jupiter .api .BeforeEach ;
1411import org .junit .jupiter .api .Test ;
@@ -145,4 +142,47 @@ void testCreateAccount_hieroExceptionThrown() throws HieroException {
145142 Exception exception = assertThrows (HieroException .class , () -> accountClientImpl .createAccount (initialBalance ));
146143 assertEquals ("Transaction failed" , exception .getMessage ());
147144 }
145+
146+
147+ @ Test
148+ void DeleteAccount_throwsHieroException () throws HieroException {
149+ Account mockAccount = mock (Account .class );
150+
151+ doThrow (new HieroException ("Deletion failed" )).when (mockProtocolLayerClient )
152+ .executeAccountDeleteTransaction (any (AccountDeleteRequest .class ));
153+
154+ HieroException exception = assertThrows (HieroException .class ,
155+ () -> accountClientImpl .deleteAccount (mockAccount ));
156+ assertEquals ("Deletion failed" , exception .getMessage ());
157+ }
158+
159+ @ Test
160+ void DeleteAccount_withSameFromAndToAccount_throwsIllegalArgumentException () {
161+ // Arrange
162+ Account account = mock (Account .class );
163+
164+ // Act & Assert
165+ IllegalArgumentException exception = assertThrows (IllegalArgumentException .class , () ->
166+ accountClientImpl .deleteAccount (account , account )
167+ );
168+
169+ assertEquals ("transferFoundsToAccount must be different from toDelete" , exception .getMessage ());
170+ }
171+
172+ @ Test
173+ void DeleteAccount_nullAccount_throwsNullPointerException () {
174+ assertThrows (NullPointerException .class , () -> accountClientImpl .deleteAccount (null ));
175+ }
176+
177+ @ Test
178+ void DeleteAccount_withTransfer_nullAccount_throwsNullPointerException () {
179+ Account toAccount = mock (Account .class );
180+ assertThrows (NullPointerException .class , () -> accountClientImpl .deleteAccount (null , toAccount ));
181+ }
182+
183+ @ Test
184+ void DeleteAccount_withSameAccount_throwsIllegalArgumentException () {
185+ Account account = mock (Account .class );
186+ assertThrows (IllegalArgumentException .class , () -> accountClientImpl .deleteAccount (account , account ));
187+ }
148188}
0 commit comments