<test>(sdk): raise unit-test coverage 54.6% -> 69.9% (pure-Java, no node)#959
Open
kyonRay wants to merge 1 commit into
Open
<test>(sdk): raise unit-test coverage 54.6% -> 69.9% (pure-Java, no node)#959kyonRay wants to merge 1 commit into
kyonRay wants to merge 1 commit into
Conversation
… 69.9% Adds offline (no live node) JUnit4 unit tests that drive the generated precompiled and auth contract wrappers, their high-level Service classes, and several pure-Java codec/model/util classes. The wrappers are exercised via a mocked Client (Mockito) plus ABI round-trips (encode known args with the SDK's own FunctionEncoder, feed to the getXxxInput/getXxxOutput decoders) and stubbed client.call(...) outputs, so no chain or JNI transaction signing is required. Unit-only JaCoCo (verifiable in CI/Codecov, which ignores integration-test dirs): instruction 54.57% -> 69.87%, line 56.24% -> 68.22%, branch -> 67.79%, method -> 76.07%. Notable package gains: contract/auth/contracts 6.7% -> 88.2%, precompiled/crud 6.8% -> 67%, consensus 12.5% -> 66%, balance 20% -> 72%, bfs 36% -> 74%, transaction/tools 36% -> 89%. Test-only change; no production code modified.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-3.9.0 #959 +/- ##
================================================
Coverage ? 63.95%
Complexity ? 4550
================================================
Files ? 430
Lines ? 17592
Branches ? 1962
================================================
Hits ? 11251
Misses ? 5591
Partials ? 750
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Adds offline (no live node) JUnit4 unit tests that substantially raise the unit-test coverage tracked by Codecov.
Unit-only JaCoCo (the CI/Codecov-visible metric —
.codecov.ymlignores the integration-test dirs):26 new test files, all passing offline under Java 8. No production code is modified.
How
The biggest "uncovered" chunks were the generated precompiled and auth contract wrappers and their high-level
*Serviceclasses — which looked integration-only but are actually pure-Java once instantiated. The tests:Client(Mockito) + a realnew CryptoSuite(CryptoType.ECDSA_TYPE)keypair — noBcosSDK.build/Client.build/ network;getXxxInput/getXxxOutputdecoders via ABI round-trips (encode known args with the SDK's ownFunctionEncoder, set them on aTransactionReceipt, decode, assert);client.call(...)with ABI-encoded outputs;ContractLoader,ContractCodec,AbiTypes,ABIDefinition,TransactionReceipt,JsonTransactionResponse,StringUtils,CryptoSuite, …) directly.Notable package gains
contract/auth/contracts6.7% → 88.2%,precompiled/crud6.8% → 67%,precompiled/consensus12.5% → 66%,precompiled/balance20% → 72%,precompiled/bfs36% → 74%,transaction/tools36% → 89%,utils→ 95%,model→ 93%.Scope / what is intentionally not covered
The remaining gap is genuinely node/JNI-dependent and not unit-testable:
ClientImplJSON-RPC, live transaction submission (nativeTransactionBuilderJniObjsigning), and theeventsub/filterpush loops. Those are exercised by theintegrationTestsuite instead.🤖 Generated with Claude Code