Wanaku Assertions Library
Wanaku provides a domain-specific assertions helper designed to keep tests concise and to surface clear, actionable failure messages.
Locationcore/core-util/src/test/java/ai/wanaku/test/assertions/WanakuAssertions.java
This class is shared across modules via the core-util test-jar (classifier tests).
Usage
Add a static import in your test:
java
import static ai.wanaku.test.assertions.WanakuAssertions.assertSuccessResponse;Common patterns
java
WanakuResponse<ToolReference> response = toolsService.getByName("my-tool");
assertSuccessResponse(response);java
assertNamespaceExists("default", namespaces);java
assertHttpSuccess(restAssuredResponse);Examples in the Codebase
These tests demonstrate the custom assertions:
cli/src/test/java/ai/wanaku/cli/main/commands/tools/ToolsLabelAddTest.javacli/src/test/java/ai/wanaku/cli/main/commands/tools/ToolsLabelRemoveTest.javawanaku-router/wanaku-router-backend/src/test/java/ai/wanaku/backend/api/v1/namespaces/NamespacesBeanTest.javawanaku-router/wanaku-router-backend/src/test/java/ai/wanaku/backend/api/v1/tools/ToolsResourceTest.javawanaku-router/wanaku-router-backend/src/test/java/ai/wanaku/backend/api/v1/resources/ResourcesResourceTest.java
Migration Guide
- Identify repeated assertion patterns (success response, tool/resource presence, namespace existence, HTTP status).
- Replace AssertJ/JUnit assertions with the closest
WanakuAssertionsmethod. - Keep any test-specific assertions (e.g., label map updates) alongside the custom assertions.
- When asserting
WanakuResponse, useassertSuccessResponseorassertErrorResponsesince the response is a record with theerror()accessor (noisSuccess()).
Quick replacements
assertThat(response.error()).isNull()
->assertSuccessResponse(response)assertThat(namespaces).extracting(Namespace::getName).contains("default")
->assertNamespaceExists("default", namespaces)response.then().statusCode(200)
->assertHttpStatus(response, 200)