Skip to main content
Rage4J

Test your LLM apps like the rest of your Java code

Evaluate RAG pipelines and AI agents in plain JUnit tests. Assert on correctness, faithfulness, relevance and tool calls, and let CI catch quality regressions.

License: MITLatest release on Maven CentralJava 21+Build status
HandbookAssistantTest.java
1
Faithfulness
Answer correctness
Running…

How it works

The test structure you already know

  1. 1given()

    Describe the case

    A question, the answer you expect, plus the context or tool calls it should use.

  2. 2when()

    Call your app

    Pass any function: a LangChain4j AI service, a REST client, your own pipeline.

  3. 3then()

    Assert on quality

    Set score thresholds per metric. A regression fails the build like any other test.

Installation

Add one test dependency

Rage4J is on Maven Central. It builds on LangChain4j, so bring the model provider you already use, such as OpenAI or Ollama.

<dependency>
<groupId>dev.rage4j</groupId>
<artifactId>rage4j-assert</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>

Stop eyeballing LLM output.

Write your first evaluation test in five minutes.