Skip to content

Conversation

@manishdait
Copy link
Contributor

Implemented test to validate the functionality of the createFile() method within the FileClientImpl class, covering both successful and failure scenarios.

Closes: #99

…eFile()

Signed-off-by: Manish Dait <daitmanish88@gmail.com>
Signed-off-by: Manish Dait <daitmanish88@gmail.com>
.thenReturn(fileCreateResult);
when(fileCreateResult.fileId()).thenReturn(fileId);
when(protocolLayerClient.executeFileAppendRequestTransaction(any(FileAppendRequest.class)))
.thenReturn(any(FileAppendResult.class));

Choose a reason for hiding this comment

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

I would suggest we avoid any() in when for Return Type since thenReturn expects a specific object. Replace it with a mocked FileAppendResult object

final FileAppendResult fileAppendResult = Mockito.mock(FileAppendResult.class);

when(protocolLayerClient.executeFileAppendRequestTransaction(any(FileAppendRequest.class))) .thenReturn(fileAppendResult);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

import java.time.Instant;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;

Choose a reason for hiding this comment

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

Remove the asterisk wildcard

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@Ndacyayisenga-droid
Copy link
Member

Thanks for working on this @manishdait!

Just a few main comments!

Signed-off-by: Manish Dait <daitmanish88@gmail.com>
@Ndacyayisenga-droid Ndacyayisenga-droid merged commit bce1fb8 into OpenElements:main Dec 18, 2024
4 checks passed
@manishdait manishdait deleted the issues-99 branch December 18, 2024 13:45
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 FileClientImpl.createFile

2 participants