Where does the maximum heap size get set when running a unit test with Gradle?

I had a failing OOM unit test and wondered why I needed to manually allow for bigger maxHeapSize like so: test { maxHeapSize = ‘4G’ } I assumed the max heap is not capped and couldn’t find anything …

NoSuchBeanDefinitionException for NamedParameterJdbcTemplate in test class

I have a problem with running unit tests with JDBCTemplate in my spring boot application. I have the following code for configuration: @Configuration @ComponentScan(“com.idoc.recon.persistence&…

Is there way to set default as null for SQL parameter?

I have a code that creates sql parameters using MapSqlParameterSource. Here is my code: MapSqlParameterSource parameters = new MapSqlParameterSource() .addValue(EVENT_ID, eventId) …

How to stop main method calling sleep() method, when testing it with Junit?

I am testing a method which contain sleep in side it.What is the way to stop invoke sleep() as it makes testing slow?? public void fun(Integer timeToWait) { TimeLimiter timeLimiter = new …

JUnit 5 @EnabledIfSystemProperty doesn’t work as expected

I migrated my test from JUnit 4 to JUnit 5. All works fine but the translation of my previous annotation: @IfProfileValue(name = “run.import.tests”, values = {“true”}) into @…

parameterized test constructor of junit java error message: Test class should have exactly one public zero-argument constructor

I can really use some help with this parameterized test case I am trying to create. No matter what kind of constructor I create the IDE gives an error message. Here is my code: @RunWith(Parameterized….

selenium webdriver detect UI pop up error messages

I have this react application being tested using selenium webdriver. if my login is wrong, how do i detect the text using selenium webdriver? I am unable to find the code/ figure out how to trap the …

Mockito Spy Does Not See Correct Primitive Value

I am facing the below problem where, when indirectly updating the fields on a spy object, the spy does NOT see updates on primitive fields, whereas it sees on reference once. As an example: import org….

Junit test of a class requires objects of other classes

I have a class defined as such: public class Monster { public static final int ARENA_SIZE = 480; public int health; //can be negative since it will then be removed public int speed; …

Run Both JUnit 4 and Junit5 With Maven Surefire Plugin – 2020

I see a few people having this issue and am struggling for a few weeks now, but not able to run both JUnit4 and JUnit5 on the same project (I need this to maintain some old tests). I noticed that if I …