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
Tag: assertj
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
Compare two lists of different objects by certain two fields
I have two lists of different objects I need to verify that these two lists have equal values for Id and Title fields. The way I see is to create Map<String, String> from two lists and then compare them. But maybe assertj has an appropriate approach to solve my issue? I would be grateful for any solution to my issue
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 assert that some String contains at least one value from the List ?
I’m testing some UI functionality with Java and AssertJ. So when I receive some massive string from UI, I should verify if that String contains at least one predefined value from List<String>. It is easy to do opposite thing – verify if list contains at least once some String value but this is not my case. I can’t find solution
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