Top "Junit4" questions

Version 4 of the popular Junit Java Unit testing framework

How to pass input from command line to junit maven test program

I wrote a junit test to add two numbers. I need to pass this numbers from command line. I am …

maven junit junit4
How to run all tests belonging to a certain Category in JUnit 4

JUnit 4.8 contains a nice new feature called "Categories" that allows you to group certain kinds of tests together. This is …

java unit-testing junit junit4
What do I use instead of Whitebox in Mockito 2.2 to set fields?

When using Mockito 1.9.x I have been using Whiteboxto set values of fields to "inject" mocks. Se example below: @Before …

java tdd mockito junit4 powermock
Basic JUnit test for JavaFX 8

I want to create basic JUnit test for JavaFX 8 application. I have this simple code sample: public class Main extends …

junit javafx-2 javafx junit4 javafx-8
Disable @EnableScheduling on Spring Tests

When I run my unit tests, it invokes my scheduled tasks. I want to prevent this behaviour, which is caused …

spring unit-testing junit junit4 springjunit4classrunner
How to execute JUnit and TestNG tests in same project using maven-surefire-plugin?

Right now I have both type of tests but when I say "mvn test" it only executes TestNG tests and …

unit-testing maven-2 testng junit4 maven-surefire-plugin
Spring @Transactional does not work in JUnit test?

I am using Spring 3.2, Hibernate and JUnit 4. My Dao class is as follows: @Transactional public class SomeDaoImpl implements SomeDao { The …

spring hibernate junit4 spring-test transactional
NoSuchMethodError with Hamcrest 1.3 & JUnit 4.11

Another instance of the NoSuchMethodError for the JUnit & Hamcrest combination. Offending code: assertThat(dirReader.document(0).getFields(), hasItem( new FeatureMatcher&…

maven junit junit4 maven-surefire-plugin hamcrest
Mockito not allowing Matchers.any() with Integer.class

I am trying to unit test this method: /** * finds all widget descriptions containing specified text * @param searchText * @return */ @Transactional public …

java junit mockito junit4 matcher
junit assertEquals ignore case

im just moving from c# -> java. I need to write some tests using junit. In my test i …

java unit-testing testing junit junit4