Skip to content

Tests for 5 classes (Issue #29)#1573

Merged
alexheifetz merged 15 commits intoembabel:mainfrom
drhiidden:test/issue-29-batch-1
Apr 6, 2026
Merged

Tests for 5 classes (Issue #29)#1573
alexheifetz merged 15 commits intoembabel:mainfrom
drhiidden:test/issue-29-batch-1

Conversation

@drhiidden
Copy link
Copy Markdown
Contributor

@drhiidden drhiidden commented Apr 5, 2026

Added unit tests for utility classes, builders, and handlers to improve test coverage.

Files

GeminiModels - 7 tests, 96 lines
Model constants for Gemini 2.0/2.5/3.0/3.1. Uses reflection for the private constructor. 100% covered.

StreamingPromptRunnerBuilder - 6 tests, 156 lines
Builder record for streaming prompt execution. Tests exception handling and field validation. 98% (record internals unreachable).

ObservationKeys - 11 tests, 155 lines
Key formatters for observation tracking. Empty strings, special chars, nulls all handled. 100%.

NonEmbabelTracingObservationHandler - 4 tests, 115 lines
Context filter for tracing. Standard contexts pass, Embabel contexts are excluded. 100%.

WaitFor - 11 tests, 176 lines
Java HITL sugar for WaitKt. Tests delegation to fromForm(), confirm(), waitFor(). Null handling and exception types. 100%.

Updates (017e4de)

Applied review feedback:

  • Private constructor tests now only verify visibility (no reflection invocation)
  • Removed redundant assertNotNull before assertEquals (21 lines cleaned)
  • Renamed confirmationThrowsOnNullWhatconfirmationThrowsOnNullPayload
  • Removed redundant empty constructor from CustomObservationContext
  • Removed redundant test createsHandlerWithTracer

Net: -43 lines of unnecessary code.

Standards

  • Copyright headers
  • JUnit 5.12.2 / Mockito 5.18.0
  • @DisplayName on all tests, camelCase names
  • AAA comments (Arrange, Act, Assert)
  • Mockito patterns per module (@ExtendWith in observability, private final in api)

39 tests pass.

Run

mvn test -pl embabel-agent-api -Dtest=GeminiModelsTest,StreamingPromptRunnerBuilderTest,WaitForTest
mvn test -pl embabel-agent-observability -Dtest=ObservationKeysTest,NonEmbabelTracingObservationHandlerTest

Thanks for reviewing!

@drhiidden drhiidden changed the title # Tests for 4 classes (Issue #29) Tests for 4 classes (Issue #29) Apr 5, 2026
Copy link
Copy Markdown
Collaborator

@simeshev simeshev left a comment

Choose a reason for hiding this comment

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

  1. Copyright and licence headers disappeared. Please make sure headers are present.
  2. StreamingPromptRunnerBuilderTest is no longer using @ExtendWith(MockitoExtension.class) and @Mock - any particular reason?
  3. Add comments // Arrange, // Act, // Assert to the appropriate sections of the tests.

Signed-off-by: drhiidden <druiz264@gmail.com>
@drhiidden drhiidden force-pushed the test/issue-29-batch-1 branch from bfc7d19 to 3b51138 Compare April 5, 2026 17:57
@drhiidden drhiidden changed the title Tests for 4 classes (Issue #29) Tests for 5 classes (Issue #29) Apr 5, 2026
…rtions

Signed-off-by: drhiidden <druiz264@gmail.com>
@drhiidden drhiidden force-pushed the test/issue-29-batch-1 branch from 03dc152 to 017e4de Compare April 6, 2026 02:07
Copy link
Copy Markdown
Collaborator

@simeshev simeshev left a comment

Choose a reason for hiding this comment

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

Looks good now.

@alexheifetz alexheifetz merged commit da2a0bc into embabel:main Apr 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants