Linked Questions

185 votes
8 answers
443k views

There are many ways to initialize a mock object using MockIto. What is best way among these ? 1. public class SampleBaseTestCase { @Before public void initMocks() { MockitoAnnotations....
Vinay Veluri's user avatar
  • 6,875
1 vote
1 answer
7k views

import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; public class SwiftTest { SwiftUtil swiftUtil = new SwiftUtil(); boolean result; @Test public ...
voldy's user avatar
  • 387
1 vote
1 answer
2k views

I am struggling a bit to understand the benefit of using ExternalResource. The documentation and other posts (How Junit @Rule works?) have all alluded to being able to share code between tests within ...
user1766760's user avatar
1 vote
3 answers
808 views

I have a lot of JUnit tests in my projects. Some of them have some side-effects that can influence the execution of other tests. For example, they open database connections and forget to close them, ...
mik01aj's user avatar
  • 12.5k
0 votes
2 answers
1k views

I try to use the following Annotation to Authenticate in Testing of my Spring Boot 2 Application. @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @Documented public @interface ...
Willey3x37's user avatar
2 votes
1 answer
396 views

This is a interview question which took my wicket. We have a selenium test class with 5,6 selenium tests. Test 3 is in execution, and network failure happened. Now once network resumes back, how to ...
Mandar Kale's user avatar
1 vote
1 answer
618 views

I have an interface that defines a contract (i.e. a Repository), with few implementations. Each method in the interface represents a feature, and I would like to test each feature in its suite test ...
MiniW's user avatar
  • 303
1 vote
1 answer
214 views

A set of tests should be run on every microservice. Current solution is to have an abstract class and extend in every service, providing the necessary properties in abstract getters. public abstract ...
dpozinen's user avatar
  • 161
0 votes
0 answers
168 views

I am writing an integration test that is a parameterized test, and I need to include @RunWith(SpringJUnit4ClassRunner.class) and @RunWith(JUnitParamsRunner.class). The problem is that I can only ...
Euge's user avatar
  • 34
0 votes
1 answer
162 views

I have multi module maven project. One parent and two submodules. In first module I have integration tests, specifically selenide tests, which are testing web application. Web application is in the ...
Mário Jaroš's user avatar