Skip to content
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

Add Some Test Cases for DashScope Components #424

Merged
merged 6 commits into from
Feb 25, 2025

Conversation

brianxiadong
Copy link
Contributor

PR: Add Test Cases for DashScope WebSocket and Metadata Components

Changes Overview

Added comprehensive test cases to improve code coverage and quality for DashScope components:

  • Added DashScopeWebSocketClientOptionsTests

    • Tests builder pattern implementation
    • Tests default values
    • Tests property setters/getters
    • Tests configuration validation
  • Added DashScopeAudioTranscriptionResponseMetadataTests

    • Tests metadata construction and factory methods
    • Tests rate limit handling
    • Tests toString representation
    • Tests null handling and edge cases
  • Added DashScopeAiUsageTests

    • Tests token usage calculations
    • Tests factory method implementations
    • Tests null handling
    • Tests edge cases with zero values

Implementation Details

  1. Used Mockito for mocking dependencies
  2. Added comprehensive assertions using AssertJ
  3. Included edge case testing
  4. Added detailed test documentation
  5. Followed test naming conventions
  6. Used StepVerifier for reactive streams testing

Testing

All tests pass successfully with good coverage. Key metrics:

  • Test methods: 25+
  • Line coverage: ~90%
  • Branch coverage: ~85%

import org.mockito.Mockito;
import org.springframework.ai.model.function.FunctionCallback;

import java.util.*;
Copy link
Collaborator

Choose a reason for hiding this comment

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

使用增量导入,别用全量引入

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

Copy link
Collaborator

@yuluo-yx yuluo-yx left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@yuluo-yx yuluo-yx left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@yuluo-yx yuluo-yx merged commit 2deaabd into alibaba:main Feb 25, 2025
4 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.

2 participants