-
Notifications
You must be signed in to change notification settings - Fork 61
<fix>(build): update dependencies version, add UT with AI. #945
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
Conversation
* Initial plan * Initial setup: Upgrade Gradle to 7.6.4 for Java 17 compatibility and fix duplicate resources handling Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add unit tests for model classes and exceptions to improve coverage Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add more unit tests for model and enum classes to increase coverage Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add unit tests for crypto exception classes to increase coverage Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Downgrade Gradle version to 6.3 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com>
* Initial plan * Add unit tests for client and transaction packages - part 1 Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add more unit tests for client protocol response and transaction dto classes Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add unit tests for LogFilterRequest, model BO classes and CommonConstant Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Fix ResultCodeEnumTest to avoid mutating enum state in tests Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com>
…codec classes (#4) * Initial plan * Add comprehensive tests for ByteUtils, ThreadPoolService, SystemInformation, SecureRandomUtils, and LinuxSecureRandom Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Add comprehensive tests for JsonRpcRequest and TopicTools Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> * Address code review feedback - fix resource cleanup and remove redundant tests Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kyonRay <32325790+kyonRay@users.noreply.github.com>
db54f64 to
c7b8f5c
Compare
|
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.
Pull Request Overview
This PR updates dependencies to newer versions, adds comprehensive unit tests generated by AI, and makes several improvements to the codebase including timeout handling and ObjectMapper configuration updates.
Key Changes:
- Dependency Updates: Upgraded Jackson (2.14.3 → 2.20.1), Commons IO (2.11.0 → 2.20.0), and Commons Lang3 (3.12.0 → 3.19.0)
- Test Coverage: Added 50+ unit test files covering exceptions, models, utilities, and transaction components
- Code Improvements: Enhanced ObjectMapper configuration, added timeout handling in ClientImpl, and removed unused imports
Reviewed Changes
Copilot reviewed 69 out of 72 changed files in this pull request and generated 35 comments.
Show a summary per file
| File | Description |
|---|---|
| build.gradle | Updated dependency versions and Maven repository URLs; added jackson-datatype-jdk8 dependency and duplicates strategy |
| .github/workflows/workflow.yml | Updated Windows test runner from windows-2019 to windows-2025 |
| src/main/java/org/fisco/bcos/sdk/v3/utils/ObjectMapperFactory.java | Modernized ObjectMapper initialization using JsonMapper.builder() with proper configurations |
| src/main/java/org/fisco/bcos/sdk/v3/crypto/keypair/ECDSAKeyPair.java | Added utility method cryptoKeyPair() for creating ECDSAKeyPair instances |
| src/main/java/org/fisco/bcos/sdk/v3/client/ClientImpl.java | Added timeout handling with TimeoutException support in callRemoteMethod |
| src/integration-wasm-test/.../BcosSDKTest.java | Cleaned up unused imports |
| src/integration-test/.../AssembleTransactionProcessorTest.java | Cleaned up unused imports |
| src/test/java/.../exception/* | Added comprehensive test coverage for exception classes |
| src/test/java/.../model/* | Added test coverage for model classes including RetCode, Response, NodeVersion, etc. |
| src/test/java/.../utils/* | Added test coverage for utility classes including StringUtils, ByteUtils, Numeric, etc. |
| src/test/java/.../transaction/* | Added test coverage for transaction-related classes and DTOs |
| src/test/java/.../codec/* | Added test coverage for codec datatypes |
| src/test/java/.../client/* | Added test coverage for client protocol classes and requests |
| src/test/java/.../crypto/exceptions/* | Added test coverage for crypto-related exceptions |
| src/test/java/.../config/exceptions/* | Added test coverage for configuration exceptions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0); | ||
| Assert.assertTrue((combined & TransactionAttribute.DAG) != 0); |
Copilot
AI
Nov 13, 2025
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.
Test is always true.
| Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0); | |
| Assert.assertTrue((combined & TransactionAttribute.DAG) != 0); | |
| // Test that EVM_ABI_CODEC bit is set in combined | |
| Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0); | |
| // Test that EVM_ABI_CODEC bit is not set when not included | |
| int notCombined = TransactionAttribute.DAG; | |
| Assert.assertFalse((notCombined & TransactionAttribute.EVM_ABI_CODEC) != 0); | |
| // Test that DAG bit is set in combined | |
| Assert.assertTrue((combined & TransactionAttribute.DAG) != 0); | |
| // Test that LIQUID_SCALE_CODEC bit is not set in combined |
|
|
||
| Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0); | ||
| Assert.assertTrue((combined & TransactionAttribute.DAG) != 0); | ||
| Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0); |
Copilot
AI
Nov 13, 2025
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.
Test is always true.
| Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0); | |
| Assert.assertTrue((combined & TransactionAttribute.DAG) != 0); | |
| Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0); | |
| // Test that EVM_ABI_CODEC and DAG are present in the combination | |
| Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0); | |
| Assert.assertTrue((combined & TransactionAttribute.DAG) != 0); | |
| Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0); | |
| // Test that DAG is not present when not included | |
| int combinedWithoutDAG = TransactionAttribute.EVM_ABI_CODEC | TransactionAttribute.LIQUID_SCALE_CODEC; | |
| Assert.assertFalse((combinedWithoutDAG & TransactionAttribute.DAG) != 0); |
|
|
||
| Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0); | ||
| Assert.assertTrue((combined & TransactionAttribute.DAG) != 0); | ||
| Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0); |
Copilot
AI
Nov 13, 2025
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.
Test is always false.
| Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0); | |
| Assert.assertEquals(0, combined & TransactionAttribute.LIQUID_SCALE_CODEC); |
| Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0); | ||
| Assert.assertTrue((combined & TransactionAttribute.DAG) != 0); | ||
| Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0); |
Copilot
AI
Nov 13, 2025
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.
Test is always true.
| Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0); | |
| Assert.assertTrue((combined & TransactionAttribute.DAG) != 0); | |
| Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0); | |
| // EVM_ABI_CODEC and DAG should be present | |
| Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0); | |
| Assert.assertTrue((combined & TransactionAttribute.DAG) != 0); | |
| // LIQUID_SCALE_CODEC should not be present | |
| Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != TransactionAttribute.LIQUID_SCALE_CODEC); | |
| // Test absence: combined without EVM_ABI_CODEC | |
| int combinedWithoutEVM = TransactionAttribute.DAG; | |
| Assert.assertFalse((combinedWithoutEVM & TransactionAttribute.EVM_ABI_CODEC) != 0); | |
| // Test presence: add LIQUID_CREATE | |
| int combinedWithCreate = combined | TransactionAttribute.LIQUID_CREATE; | |
| Assert.assertTrue((combinedWithCreate & TransactionAttribute.LIQUID_CREATE) != 0); |
|
|
||
| Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0); | ||
| Assert.assertTrue((combined & TransactionAttribute.DAG) != 0); | ||
| Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0); |
Copilot
AI
Nov 13, 2025
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.
Test is always true.
| Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0); | |
| // Test that a flag not included in 'combined' is absent | |
| Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != TransactionAttribute.LIQUID_SCALE_CODEC); |
| public void testExceptionDoesNotRequireChecked() { | ||
| // Since JsonException extends RuntimeException, it can be thrown without being declared | ||
| JsonException exception = new JsonException("Unchecked exception"); | ||
| Assert.assertTrue(exception instanceof RuntimeException); |
Copilot
AI
Nov 13, 2025
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.
There is no need to test whether an instance of JsonException is also an instance of RuntimeException - it always is.
| public void testSerialVersionUID() { | ||
| // Test that the exception is serializable | ||
| JsonException exception = new JsonException("Test"); | ||
| Assert.assertTrue(exception instanceof java.io.Serializable); |
Copilot
AI
Nov 13, 2025
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.
There is no need to test whether an instance of JsonException is also an instance of Serializable - it always is.
| @Test | ||
| public void testExceptionIsThrowable() { | ||
| TransactionBaseException exception = new TransactionBaseException(100, "Test"); | ||
| Assert.assertTrue(exception instanceof Exception); |
Copilot
AI
Nov 13, 2025
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.
There is no need to test whether an instance of TransactionBaseException is also an instance of Exception - it always is.
| public void testExceptionIsThrowable() { | ||
| TransactionBaseException exception = new TransactionBaseException(100, "Test"); | ||
| Assert.assertTrue(exception instanceof Exception); | ||
| Assert.assertTrue(exception instanceof Throwable); |
Copilot
AI
Nov 13, 2025
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.
There is no need to test whether an instance of TransactionBaseException is also an instance of Throwable - it always is.
| public void testSerialVersionUID() { | ||
| // Test that the exception is serializable | ||
| TransactionBaseException exception = new TransactionBaseException(100, "Test"); | ||
| Assert.assertTrue(exception instanceof java.io.Serializable); |
Copilot
AI
Nov 13, 2025
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.
There is no need to test whether an instance of TransactionBaseException is also an instance of Serializable - it always is.



No description provided.