Skip to content

test(framework): consolidate and stabilize CredentialsTest#6614

Open
3for wants to merge 2 commits intotronprotocol:developfrom
3for:credential_test_fix
Open

test(framework): consolidate and stabilize CredentialsTest#6614
3for wants to merge 2 commits intotronprotocol:developfrom
3for:credential_test_fix

Conversation

@3for
Copy link
Copy Markdown

@3for 3for commented Mar 31, 2026

What does this PR do?

This PR cleans up and consolidates CredentialsTest coverage in the framework module.

  • removes the duplicate test under the incorrect package path org.tron.keystroe
  • keeps the test in the correct package org.tron.keystore
  • replaces random key generation with deterministic mocked SignInterface fixtures
  • adds stronger assertions for Credentials.create(...), equals(...), and hashCode()

Why are these changes required?

The previous test setup had two problems:

  1. test coverage was split across two locations, including a typo package path
  2. some assertions depended on random key generation, which made the test intent less explicit and less stable

This change makes the test deterministic, easier to understand, and better aligned with the current Credentials contract:

  • address is derived from getAddress()
  • equality depends on both cryptoEngine and address
  • equal objects must have the same hashCode

This PR has been tested by:

  • Unit Tests
    • ./gradlew framework:test --tests org.tron.keystore.CredentialsTest

Follow up

No follow-up is required.

Extra details

This is a test-only change. No production logic, protocol behavior, or runtime code path is modified.

3for added 2 commits March 31, 2026 11:27
Consolidate the misplaced keystroe CredentialsTest into org.tron.keystore.CredentialsTest.

- remove the duplicate test under the misspelled keystroe package
- add explicit equals behavior coverage for address and cryptoEngine
- normalize assertions to JUnit Assert and remove legacy TestCase usage
Replace random Credentials test setup with deterministic SignInterface mocks
so the suite no longer depends on platform-specific SecureRandom providers or
probabilistic retries.

- remove NativePRNG usage from CredentialsTest
- replace random key generation with fixed address fixtures via mocked SignInterface
- assert create(SignInterface) returns the expected base58check address
- keep equals/hashCode contract coverage with deterministic inputs
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