Top "Junit4" questions

Version 4 of the popular Junit Java Unit testing framework

How to write JUnit test with Spring Autowire?

Here are the files that I use: component.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.…

java spring playframework-2.0 junit4
Getting "NoSuchMethodError: org.hamcrest.Matcher.describeMismatch" when running test in IntelliJ 10.5

I'm using JUnit-dep 4.10 and Hamcrest 1.3.RC2. I've created a custom matcher that looks like the following: public static class MyMatcher …

java junit intellij-idea junit4 hamcrest
How to configure log4j.properties for SpringJUnit4ClassRunner?

Suddenly this keeps happening during a JUnit test. Everything was working, I wrote some new tests and this error occured. …

java spring log4j junit4
@RunWith(MockitoJUnitRunner.class) vs MockitoAnnotations.initMocks(this)

While writing a new jUnit4 test, I'm wondering whether to use @RunWith(MockitoJUnitRunner.class) or MockitoAnnotations.initMocks(this). I created …

java junit4 mockito
assert that a list is not empty in JUnit

I want to assert that a list is not empty in JUnit 4, when I googled about it I found this …

junit junit4
Mockito + PowerMock LinkageError while mocking system class

I've got such a code snippet: @RunWith(PowerMockRunner.class) @PrepareForTest({Thread.class}) public class AllMeasuresDataTest { @Before public void setUp() throws …

java mockito junit4 powermock linkageerror
"Assert in junit.framework has been deprecated" - what next to use?

I bump version of junit to 4.11 and get: [WARNING] [deprecation] Assert in junit.framework has been deprecated [WARNING] [deprecation] Assert …

junit junit4
setUp/tearDown (@Before/@After) why we need them in JUnit?

I believe that we are all know that setUp (@Before) will execute before any test method and tearDown(@After) will …

java junit junit4 junit3
Why is assertEquals(double,double) deprecated in JUnit?

I was wondering why assertEquals(double, double) is deprecated. I used import static org.junit.Assert.assertEquals; and I used …

java junit junit4
How to use VisibleForTesting for pure JUnit tests

I´m running pure JUnit4 java tests over my pure java files on my project but I can't find a …

java android junit junit4 android-testing