Hi,
I am trying to use diffblue to generate test cases but getting āApplicationContextā error. I have attached the error logs here. It is generating test for simpler methods but complex methods with dao calls to database is failing.
Any help would be appreciated.
15:58:53 Writing tests for: WaitListServiceImpl.getHttpRequestHeaders
15:59:36 Failed to create Spring context: Attempt to initialize test context failed with āFailed to load ApplicationContextā at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:132) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:123) when running class:
package com.wdpr.dvc.memavail.service.impl;
@org.springframework.test.context.ContextConfiguration(classes = {com.wdpr.dvc.memavail.service.impl.WaitListServiceImpl.class})
@org.junit.runner.RunWith(value = org.springframework.test.context.junit4.SpringRunner.class) // if JUnit 4
@org.junit.jupiter.api.extension.ExtendWith(value = org.springframework.test.context.junit.jupiter.SpringExtension.class) // if JUnit 5
public class DiffblueFakeClass0 {
@org.springframework.boot.test.mock.mockito.MockBean J long;
@org.springframework.boot.test.mock.mockito.MockBean(name = āimmediateBlockServiceā) com.wdpr.dvc.memavail.blockInventory.BlockService blockService;
@org.springframework.boot.test.mock.mockito.MockBean com.wdpr.dvc.memavail.clients.msgsv.DrmctApiImpl drmctApiImpl;
@org.springframework.boot.test.mock.mockito.MockBean com.wdpr.dvc.memavail.clients.msgsv.FreeSellAPIImpl freeSellAPIImpl;
@org.springframework.boot.test.mock.mockito.MockBean javax.servlet.http.HttpServletRequest httpServletRequest;
@org.springframework.boot.test.mock.mockito.MockBean com.wdpr.dvc.memavail.service.MemApiService memApiService;
@org.springframework.boot.test.mock.mockito.MockBean com.wdpr.dvc.memavail.service.OffersAvailabilityService offersAvailabilityService;
@org.springframework.boot.test.mock.mockito.MockBean com.wdpr.dvc.memavail.clients.msgsv.PointsPricingImpl pointsPricingImpl;
@org.springframework.boot.test.mock.mockito.MockBean com.wdpr.dvc.memavail.service.RetrieveRoomListPackageService retrieveRoomListPackageService;
@org.springframework.boot.test.mock.mockito.MockBean com.wdpr.dvc.memavail.util.TravelBoxUtil travelBoxUtil;
@org.springframework.boot.test.mock.mockito.MockBean com.wdpr.dvc.memavail.dao.WaitListEntriesDAO waitListEntriesDAO;
@org.springframework.beans.factory.annotation.Autowired com.wdpr.dvc.memavail.service.impl.WaitListServiceImpl waitListServiceImpl;
@org.junit.Test // if JUnit 4
@org.junit.jupiter.api.Test // if JUnit 5
public void testSpringContextLoads() {}
}
emphasized text