Skip to content

code cleanup - #56

Merged
Fivell merged 2 commits into
mainfrom
chore/cleanup
Aug 6, 2026
Merged

code cleanup#56
Fivell merged 2 commits into
mainfrom
chore/cleanup

Conversation

@Fivell

@Fivell Fivell commented Aug 2, 2026

Copy link
Copy Markdown
Member

Replaced the generic SingletonRepository with a dedicated BalanceRepository, swapped a manual buffer-copy loop for a standard library call, and removed an empty leftover test folder. No behavior changes, all tests pass.

Fivell added 2 commits August 2, 2026 18:56
SingletonRepository<T> had exactly one instantiation (Balance) anywhere
in the codebase. A generic base existed for a single use site.
Replace hand-rolled byte[8192] read/write loop in downloadAndDecompressExport
with stdlib InputStream.transferTo (Java 9+, build targets 11). Tightened the
existing end-to-end decompression test to assert exact output instead of
partial contains() checks, pinning current behavior before the swap.
@Fivell Fivell self-assigned this Aug 2, 2026
@sonarqubecloud

sonarqubecloud Bot commented Aug 2, 2026

Copy link
Copy Markdown

@Fivell Fivell changed the title chore: over-engineering cleanup (ponytail audit) chore: over-engineering cleanup Aug 2, 2026
@Fivell Fivell changed the title chore: over-engineering cleanup code cleanup Aug 3, 2026
@Fivell
Fivell requested a review from Copilot August 3, 2026 08:23

Copilot AI left a comment

Copy link
Copy Markdown

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 performs cleanup in the SDK by introducing a dedicated BalanceRepository, simplifying export decompression using the Java standard library, and tightening an export decompression test assertion.

Changes:

  • Replace the generic singleton-style repository with a dedicated BalanceRepository and update DidwwClient.balance() to use it.
  • Simplify gzip decompression by replacing a manual read/write loop with InputStream.transferTo(...).
  • Update ExportTest to assert full CSV equality after decompression.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/main/java/com/didww/sdk/repository/BalanceRepository.java Introduces a dedicated repository for the balance singleton endpoint.
src/main/java/com/didww/sdk/DidwwClient.java Switches balance() to return BalanceRepository and simplifies decompression implementation.
src/test/java/com/didww/sdk/resource/ExportTest.java Strengthens decompression test assertion to match full expected CSV content.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 131 to 134
// Singleton repository
public SingletonRepository<Balance> balance() {
return new SingletonRepository<>(httpClient, converter, baseUrl, "balance", Balance.class, objectMapper);
public BalanceRepository balance() {
return new BalanceRepository(httpClient, converter, baseUrl, "balance", objectMapper);
}
@Fivell
Fivell merged commit 81aed27 into main Aug 6, 2026
6 checks passed
@Fivell
Fivell deleted the chore/cleanup branch August 6, 2026 09:26
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.

2 participants