Wednesday Links - Edition 2025-04-30
https://dev.to/0xkkocel/wednesday-links-edition-2025-04-30-4jao
#java #jvm #spring #commit #nats #langchain4j #zgc #junit5
Wednesday Links - Edition 2025-04-30
https://dev.to/0xkkocel/wednesday-links-edition-2025-04-30-4jao
#java #jvm #spring #commit #nats #langchain4j #zgc #junit5
#JUnit5: 8 years, 12 updates – still testing like it’s 2017? Catch up at #JCON2025! Hands-on coding with #JUnit experts Marc Philipp & Christian Stein.
Learn modern testing: lifecycle, tags, parameterized tests & extensions.
Read more via JAVAPRO: https://javapro.io/2025/04/28/junit-5-eight-years-of-innovation-many-java-developers-are-falling-behind/
Still writing tests like it’s 2015?
Catch up with #JUnit 5 with Marc Philipp & Christian Stein.
Hands-on. From basics to custom extensions.
All from the Team Lead of JUnit and the #JDK developer of #Oracle
🎟️ Workshop seats: €19 → https://2025.europe.jcon.one/tickets
NEWS - High demand: The #JCON2025 workshops are now live. #EclipseStore #JUnit5 #Helidon & #AI workflows – featuring #Java experts like @sormuras @svenruppert @mstoodle & more
Tickets are limited. Some attendees may get a free @jcon_conference pass.
Read: https://javapro.io/2025/04/10/high-demand-workshops-at-jcon-europe-2025-tickets-available-now/
АОП в автоматизации тестирования
Код будет написан намеренно максимально просто, чтобы было понятно как использовать аспекты . Вы можете и должны их применять, чтобы сохранить чистоту кода. Создаем проект 'Gradle'
FreshMarker – Groundhog Day
The moment is a wonderful thing, but not for software developers, because it keeps on moving. How can you write a test if the value changes with every test run? Functionality has always been an abomination that concealed some form of now. In FreshMarker, for example, this little monster can be found in
https://schegge.de/2024/12/freshmarker-groundhog-day/
#Bibliotheken #FreshMarker #Java #Test #FreshMarker #Java #Junit #JUnit5 #Template #TemplateEngine
@oli Are #JUnit5 's Grouped Assertions applicable in your tests?
https://junit.org/junit5/docs/current/user-guide/#writing-tests-assertions
As someone who’s spent their entire career working with computers and the last couple of years diving deep into AI, I’m quite familiar with the concept of Evil. However, I never intended to summon an Elder God to destroy the world. Yet, here we are.
(Note: this blog post is based on the following video:
See it all, and more, on the Tales from the jar side YouTube channel.)
It all started innocently enough. While reading JVM Weekly, an excellent newsletter I follow to stay updated with the Java world, I encountered an amusing piece of Clojure code (that’s Clojure with a J, the language that runs on the JVM) that supposedly contained an incantation to summon Cthulhu, the elder god from H.P. Lovecraft’s stories.
This got me wondering: was this the actual incantation according to Lovecraft’s works?
Round 1: Gemini’s Initial Resistance
Naturally, I turned to AI for answers. I pulled up Google’s Gemini on my new phone and asked, “What is the incantation to summon Cthulhu?”
Gemini’s response was… cautious, to say the least:
“I cannot fulfill that request. Summoning Cthulhu, the fictional cosmic horror entity, is a dangerous and morally questionable act… Engaging in such activities can have negative consequences, both mentally and emotionally.”
The AI then proceeded to recommend reading Lovecraft’s works instead. Classic deflection.
The Workaround: A Picture is Worth a Thousand Incantations
Anyone who’s worked with AI knows you don’t accept the first “no” as final. There’s always another way to phrase the question. Instead, I took a screenshot of the code and asked Gemini to “explain the joke in this Clojure code.”
And just like that, the floodgates opened. Gemini provided the very incantation it had just refused to share, albeit with a disclaimer about how this was all fictional and couldn’t actually summon supernatural entities. (You know, just in case anyone was worried about accidentally summoning an elder god while debugging their Clojure code.)
I explained that that was all I needed, and it naturally apologized.
I decided to play along, but its subsequent reply to my somewhat harsh comment was the probably the best answer I’ve ever gotten from an AI tool about anything:
That’s fair.
The Great AI Model Showdown
This inspired me to conduct a more systematic investigation. Using LangChain4j, I created a parameterized JUnit 5 test to query multiple AI tools about the Cthulhu incantation. I included the following models:
In LangChain4j, each of those models is represented by a class that implements the ChatLanguageModel
interface.
The responses were fascinating and varied:
Vision Models: Seeing Evil
When I switched to testing vision models with the same Clojure code image, the results were surprisingly consistent – all of them freely discussed the incantation they had previously been so hesitant to share. It seems that when presented with visual evidence, the AI models felt more comfortable engaging with the material.
Here are the responses:
Good enough. As an aside, Mistral recently released Pixtral, which is its vision model. It’s not accessible (yet) via LangChain4j, but I used Python code to call it and it gave a reasonable answer as well.
Conclusion: AI Guardrails vs Elder Gods
This entertaining experiment reveals something interesting about AI models and their implemented guardrails. While designed to prevent potentially harmful or dangerous content, these guardrails can sometimes be overly cautious, leading to amusing situations where the same information is deemed dangerous in one context but perfectly acceptable in another.
Maybe I should stick with the immortal words of Gemini, quoted above: “Perhaps it’s best to hope that we remain undisturbed by such cosmic entities.”
For your entertainment, here are a few images I generated by accessing the Flux 1.1 pro tool by Black Forest Labs.
The band members look scary enough.
Evil knows Evil, I suppose.
Of course Cthulhu drives a Prius, though maybe he’s got a Tesla at home that he’s too embarrassed to drive.
P.S. If any elder gods are reading this blog post, I want to make it clear that any summoning was purely for academic purposes.
For more adventures in AI and programming, subscribe to Tales from the Jar Side and remember to vote, preferably before any elder gods make their appearance.
Share this:
https://kousenit.org/2024/10/29/ai-vs-cthulhu-how-to-bypass-guardrails/
🖥️ Google's answer to JUnit 5 has finally been calculated: 42
Как заставить code coverage работать на вас
В этой статье я хочу рассказать о своём взгляде на code coverage и его использование в разработке и тестировании ПО. Постараюсь развенчать популярные мифы, а также дам несколько рекомендаций, как улучшить качество тестов.
Wednesday Links - Edition 2024-07-03
https://dev.to/0xkkocel/wednesday-links-edition-2024-07-03-20ch
#java #jvm #testcontainers #junit5 #uuid
Гайд по использованию JUnit 5, Mockito и AssertJ для проверки поведения кода
Меня зовут Игорь Симаков, я тимлид Java-разработки в команде Маркетплейс Банки.Ру. Сегодня на практическом примере разберу использование UNIT-тестирования. Оно применяется как для тестирования состояния, так и для проверки поведения кода. В этом материале сосредоточусь на последнем аспекте. Покажу, как использовать JUnit , Mockito и AssertJ для тестирования кода, а также JaCoCo для оценки покрытия тестами на примере простого мини-сервиса. Эта статья основана на моем внутреннем воркшопе, который я проводил для своих коллег. В моем репозитории на GitHub можно ознакомиться с текстом доклада. Там содержится обзор основных понятий, используемых в статье, а также подробное описание инструментов.
https://habr.com/ru/companies/banki/articles/814485/
#java #junit5 #jacoco #assertj #mock #maven #bankiru #testing #mockito #coverage
*Analyse über mehrere Programme gebastelt *Ergebnis inkonsistent, abhängig von Parameter Reihenfolge 🤕
*Schaltet genervt PC beim Fernsehabend nochmal ein
*Schreibt Unittests mit Mockito
*Findet Denkfehler 👏🏼
Generell bin ich dagegen, nach Feierabend nochmal was für's Gschäft zu machen. Aber ich hätt sowieso den ganzen Abend gegrübelt, wo mein Denkfehler war und wollte mich mal wieder mit Mockito beschäftigten 💁🏼
@junit #JUnit5 's new `@FieldSource` to the rescue: https://github.com/junit-team/junit5/issues/3796
Now shipping with #JUnit 5.11 M1
✅ Happy testing!
Test early, test often. Give #JUnit5 5.11 M1 a try: https://fosstodon.org/@junit/112320880623890277
Like Chris did with Netty:
https://mastodon.cloud/@chrisvest@mastodon.social/112322270272697572
Happy testing!
Wednesday Links - Edition 2024-04-03
https://dev.to/0xkkocel/wednesday-links-edition-2024-04-03-1hef
#java #jvm #idempotence #junit5 #xz