Skip to content

Conversation

@kyonRay
Copy link
Member

@kyonRay kyonRay commented Nov 7, 2025

No description provided.

kyonRay and others added 5 commits November 4, 2025 14:58
* 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>
@sonarqubecloud
Copy link

@kyonRay kyonRay requested a review from Copilot November 13, 2025 03:05
Copilot finished reviewing on behalf of kyonRay November 13, 2025 03:06
Copy link

Copilot AI left a 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.

Comment on lines +45 to +47

Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0);
Assert.assertTrue((combined & TransactionAttribute.DAG) != 0);
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

Test is always true.

Suggested change
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

Copilot uses AI. Check for mistakes.
Comment on lines +45 to +48

Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0);
Assert.assertTrue((combined & TransactionAttribute.DAG) != 0);
Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0);
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

Test is always true.

Suggested change
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);

Copilot uses AI. Check for mistakes.

Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0);
Assert.assertTrue((combined & TransactionAttribute.DAG) != 0);
Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0);
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

Test is always false.

Suggested change
Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0);
Assert.assertEquals(0, combined & TransactionAttribute.LIQUID_SCALE_CODEC);

Copilot uses AI. Check for mistakes.
Comment on lines +46 to +48
Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0);
Assert.assertTrue((combined & TransactionAttribute.DAG) != 0);
Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0);
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

Test is always true.

Suggested change
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);

Copilot uses AI. Check for mistakes.

Assert.assertTrue((combined & TransactionAttribute.EVM_ABI_CODEC) != 0);
Assert.assertTrue((combined & TransactionAttribute.DAG) != 0);
Assert.assertFalse((combined & TransactionAttribute.LIQUID_SCALE_CODEC) != 0);
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

Test is always true.

Suggested change
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);

Copilot uses AI. Check for mistakes.
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);
Copy link

Copilot AI Nov 13, 2025

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.

Copilot uses AI. Check for mistakes.
public void testSerialVersionUID() {
// Test that the exception is serializable
JsonException exception = new JsonException("Test");
Assert.assertTrue(exception instanceof java.io.Serializable);
Copy link

Copilot AI Nov 13, 2025

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.

Copilot uses AI. Check for mistakes.
@Test
public void testExceptionIsThrowable() {
TransactionBaseException exception = new TransactionBaseException(100, "Test");
Assert.assertTrue(exception instanceof Exception);
Copy link

Copilot AI Nov 13, 2025

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.

Copilot uses AI. Check for mistakes.
public void testExceptionIsThrowable() {
TransactionBaseException exception = new TransactionBaseException(100, "Test");
Assert.assertTrue(exception instanceof Exception);
Assert.assertTrue(exception instanceof Throwable);
Copy link

Copilot AI Nov 13, 2025

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.

Copilot uses AI. Check for mistakes.
public void testSerialVersionUID() {
// Test that the exception is serializable
TransactionBaseException exception = new TransactionBaseException(100, "Test");
Assert.assertTrue(exception instanceof java.io.Serializable);
Copy link

Copilot AI Nov 13, 2025

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.

Copilot uses AI. Check for mistakes.
@kyonRay kyonRay merged commit 756f823 into FISCO-BCOS:release-3.9.0 Nov 13, 2025
10 of 11 checks passed
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.

1 participant