Skip to content

Tag: junit5

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 th…

Condition fails in Junit5 & Mockito

I am trying to write the test case for my application and I cannot get past a condition even after providing what is expected, from what I know. Here is my test class. My implementation. The test doesn’t go past the if condition. The test does not cover the code after the condition as it turns true all …

JUnit 5 and Test Suites

We have a pure JUnit-5 project and we want to categories our unit tests. To do so, what I understand is we need to include the JUnit-4 @RunWith(JUnitPlatform.class). In Intellij-Idea I can run all or just test suites without problems but I get an error on the execution with maven: in Intellij-Idea some test c…