Skip to content
Advertisement

Tag: assertj

Using QuarkusTestExtension in combination with another JUnit extension leads to exception

Is it possible to use the QuarkusTestExtension from Quarkus in combination with the SoftAssertionsExtension from AssertJ? I would like to run a Quarkus test which implicitly calls softAssertions.assertAll() after a test which uses AssertJ’s soft assertions. I’m always encountering an exception, though. Context: I’m using io.quarkus:quarkus-junit5:1.13.3.Final and org.assertj:assertj-core:3.21.0. This is the annotation which I`ve created. This is my test. Inspired

Java does not catch exception

I am trying to implement lambda expression for constructor. My constructor can throw an IllegalArgumentException. I tried different ways. First way is just calling lambda expression: It works perfectly fine, I can catch Exception and then parse it. The problem occurs when I try to use my own interface: and then I use it as: But the last line of

Ignoring only embedded member in AssertJ

I have two classes to test with JUnit/Mockito: Then in my test class, using AssertJ: The problem is that the name sk is in both classes, and I need to ignore it only in ClassA, not in ClassB. Is this possible in AssertJ? Answer According to the ignoringFields javadoc: Nested fields can be specified like this: home.address.street. …so with your

How to perform deeper matching of keys and values with assertj

Say I have a class like this: And later, a Map Using assertj, what is the best way to test that characterAges includes the “Frodo” character? For the age, I can do: And I know I could do: But then I lose my fluency. What I really want it something like this: Or even better, so that I can make

Advertisement