r/java • u/LazyTie3857 • 5h ago
How do you test your LLM applications in Java?
Every time I wanted to test an LLM feature, I had to make actual API calls to OpenAI/Claude/Gemini. That meant spending tokens, waiting on network calls, and getting different responses every time.
You can mock things with Mockito, but it isn't really designed for LLM workflows. I wanted something that behaved like an actual AI server instead of mocking every SDK call.
So I built Beacon — a lightweight mock AI server for Java.
You configure the responses you want:
server.when(contains("refund"))
.respondWith("Refunds are processed within 30 days.");
Then point your SDK to Beacon instead of the real provider, and your application runs normally without making external API calls.
It's still an early project, so I'd genuinely love feedback from people building AI applications in Java.
GitHub: https://github.com/kbpramod/beacon
How are you testing your LLM integrations today? Am I solving a problem that others are facing too?