Top "Junit4" questions

Version 4 of the popular Junit Java Unit testing framework

How make JUnit print assertion results

How can I get the results of my JUnit assertions to be printed [to standard output]? I have some tests …

java testing junit junit4
IntelliJ IDEA cannot see Lombok generated code

I have a Gradle-based project that uses lombok. I have imported this project into IntelliJ IDEA 14.1 (using the Import External …

java intellij-idea junit4 lombok intellij-lombok-plugin
Changing names of parameterized tests

Is there a way to set my own custom test case names when using parameterized tests in JUnit4? I'd like …

java junit junit4 parameterized
JUnit tests always rollback the transactions

I'm running a simple JUnit test agains an application DAO. The problem is that I always get: javax.persistence.RollbackException: …

java spring junit4
Why Can't I access src/test/resources in Junit test run with Maven?

I am having a problems running the following code: configService.setMainConfig("src/test/resources/MainConfig.xml"); From within a Junit @…

java junit4 mockito
Counting method invocations in Unit tests

What is the best way to count method invocations in a Unit Test. Do any of the testing frameworks allow …

unit-testing junit4 mockito jmockit
Mock static methods from multiple class using PowerMock

I know how to mock static methods from a class using PowerMock. But I want to mock static methods from …

java junit4 powermock
spring - @ContextConfiguration fail to load config file in src/test/resources

I've tried to load the spring config file in src/test/resources classpath with the following abstract class: @RunWith(SpringJUnit4…

java spring maven-2 junit junit4
Reuse spring application context across junit test classes

We've a bunch of JUnit test cases (Integration tests) and they are logically grouped into different test classes. We are …

spring junit junit4 spring-test
Mock class in class under test

How I can mock with Mockito other classes in my class which is under test? For example: MyClass.java class …

java unit-testing junit4 mockito robolectric