-
Notifications
You must be signed in to change notification settings - Fork 81
Issue-174: Mock iota client in integration tests #235
base: dev
Are you sure you want to change the base?
Issue-174: Mock iota client in integration tests #235
Conversation
…UE-229-removal-of-checkConsistency ISSUE-229: Remove check consistency code, test and related docs
|
Issues
======
+ Solved 6
- Added 56
Complexity increasing per file
==============================
- jota/src/test/java/org/iota/jota/IotaMultiSigTest.java 1
Clones added
============
- jota/src/test/java/org/iota/jota/IotaAPITest.java 2
- jota/src/test/java/org/iota/jota/IotaMultiSigTest.java 2
See the complete overview on Codacy |
| @Test | ||
| public void shouldIsArrayOfTrytes() { | ||
| assertEquals(InputValidator.isArrayOfTrytes(new String[]{TEST_TRYTES, TEST_TRYTES}), true); | ||
| assertTrue(InputValidator.isArrayOfTrytes(new String[]{TEST_TRYTES, TEST_TRYTES})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
|
|
||
| List<Transaction> transactionObjectsByAddresses = iotaAPIMock.findTransactionObjectsByAddresses(TEST_ADDRESSES); | ||
|
|
||
| assertNotNull(transactionObjectsByAddresses); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| FindTransactionResponse transactionsByApproves = | ||
| iotaAPIMock.findTransactionsByApprovees(TEST_ADDRESS_WITHOUT_CHECKSUM); | ||
|
|
||
| assertNotNull(transactionsByApproves.getHashes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
|
|
||
| GetNodeInfoResponse nodeInfo = iotaAPIMock.getNodeInfo(); | ||
|
|
||
| assertNotNull(nodeInfo.getAppVersion()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| when(iotaAPIMock.findTransactions(addresses, tags, approves, bundles)).thenReturn(new FindTransactionResponse()); | ||
|
|
||
| FindTransactionResponse transactionResponse = iotaAPIMock.findTransactions(addresses, tags, approves, approves); | ||
| assertNotNull(transactionResponse); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| when(iotaAPIMock.getAddressesUnchecked(addressRequest)).thenReturn(newAddressResponse); | ||
|
|
||
| GetNewAddressResponse addressResponse = iotaAPIMock.getAddressesUnchecked(addressRequest); | ||
| assertEquals(TEST_ADDRESS_WITH_CHECKSUM_SECURITY_LEVEL_2, addressResponse.getAddresses().get(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| for (int i = 0; i < TEST_TRYTES_VALUE_TRANSFER.length; i++) { | ||
| assertEquals(new Transaction(localResponse.getTrytes()[i]).getValue(), | ||
| new Transaction(remoteResponse.getTrytes()[i]).getValue()); | ||
| assertEquals(new Transaction.Builder().buildWithTrytes(localResponse.getTrytes()[i]).getValue(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| FindTransactionResponse transactionsByAddresses = | ||
| iotaAPIMock.findTransactionsByAddresses(TEST_ADDRESS_WITHOUT_CHECKSUM); | ||
|
|
||
| assertNotNull(transactionsByAddresses.getHashes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| when(iotaAPIMock.getAddressesUnchecked(addressRequest)).thenReturn(newAddressResponse); | ||
|
|
||
| GetNewAddressResponse res1 = iotaAPIMock.getAddressesUnchecked(addressRequest); | ||
| assertEquals(TEST_ADDRESS_WITH_CHECKSUM_SECURITY_LEVEL_3, res1.getAddresses().get(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| final GetNewAddressResponse res3 = iotaAPI.getAddressesUnchecked(thirdAddressRequest); | ||
| assertEquals(TEST_ADDRESS_WITH_CHECKSUM_SECURITY_LEVEL_3, res3.getAddresses().get(0)); | ||
| GetNewAddressResponse addressResponse = iotaAPIMock.getAddressesUnchecked(addressRequest); | ||
| assertEquals(TEST_ADDRESS_WITH_CHECKSUM_SECURITY_LEVEL_1, addressResponse.getAddresses().get(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| } if (!transfer.getMessage().equals("")) { | ||
|
|
||
| } | ||
| if (!transfer.getMessage().equals("")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: Avoid empty if statements
| when(balancesResponseMock.getDuration()).thenReturn(0L); | ||
|
|
||
| assertThat(balancesResponse.getReferences(), IsNull.notNullValue()); | ||
| assertThat(balancesResponse.getBalances(), IsNull.notNullValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| assertThat(balancesResponse.getReferences(), IsNull.notNullValue()); | ||
| assertThat(balancesResponse.getBalances(), IsNull.notNullValue()); | ||
| assertThat(balancesResponse.getMilestoneIndex(), IsNull.notNullValue()); | ||
| assertThat(balancesResponse.getDuration(), IsNull.notNullValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| assertThat("Error on getInputs should have thrown", res.getInputs(), IsNull.notNullValue()); | ||
| GetBalancesAndFormatResponse inputs = iotaAPIMock.getInputs(TEST_SEED1, 2, 0, 10, 0); | ||
|
|
||
| assertNotNull(inputs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| GetNodeInfoResponse nodeInfo = iotaAPIMock.getNodeInfo(); | ||
|
|
||
| assertNotNull(nodeInfo.getAppVersion()); | ||
| assertNotNull(nodeInfo.getAppName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
|
|
||
| GetAccountDataResponse accountData = iotaAPIMock.getAccountData(TEST_SEED3, 2, 0, true, 0, true, 0, 10, true, 0); | ||
|
|
||
| assertNotNull(accountData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| assertNotNull(nodeInfo.getAppName()); | ||
| assertNotNull(nodeInfo.getJreVersion()); | ||
| assertNotNull(nodeInfo.getLatestMilestone()); | ||
| assertNotNull(nodeInfo.getLatestSolidSubtangleMilestone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
| when(balancesResponseMock.getBalances()).thenReturn(new String[]{}); | ||
| when(balancesResponseMock.getDuration()).thenReturn(0L); | ||
|
|
||
| assertThat(balancesResponse.getReferences(), IsNull.notNullValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codacy found an issue: JUnit assertions should include a message
|
I am not sure if the checks regarding the assertions are useful. On the one hand this contradicts the Clean Code concept by saying that the methods should be named in a way that they make a statement about what the method does (What is tested?). On the other hand I doubt the quality of the messages. |
|
Yea thanks for the Codacy fixes you did, I'm honestly just surprised it decided to work suddenly :) |
…:ManuZiD/iota-java into feature/ISSUE-174-mock-integration-tests
|
@kwek20 now it should be fine |
|
@ezienecker Thanks for the ping 🙏 On it! |
Description of change
Mock iota client in integration test
Type of change
Choose a type of change, and delete any options that are not relevant.
How the change has been tested
Running the tests.
Make sure to provide instructions for the maintainer as well as any relevant configurations.
Change checklist
Add an
xto the boxes that are relevant to your changes, and delete any items that are not.