Questions tagged [springjunit4classrunner]

55 questions
1
vote
2 answers

JmsListenerContainerFacotory Not available: NoSuchBeanDefinitionException, even though have configured a DefaultJmsListenerContainerFactory

I am writing unit/integration test to check whether the JMS listener using IBM MQ is getting called correctly. There are two listeners in my IncomingDataListener. They are for two types of data comming in the same queue, processed by…
1
vote
0 answers

Migrating Spring 4 to Spring 5 lead to failed Junits using SpringJUnit4ClassRunner

Recently, we have migrated our application from Spring 4 to Spring 5, It has caused failing of Junits. Getting error: java.lang.IllegalStateException: Failed to load ApplicationContext at…
TestUser
  • 31
  • 2
1
vote
0 answers

Intellij Test Case not Exiting

I am using Intellij 2019.2 version. I have a project where we have Java and Kotlin used for source code. Gradle is used for compile and build. JUnit 4 test cases have been added for Java code. Test cases for package, run fine and succeed, but the…
1
vote
1 answer

Configuration of SpringJUnit4ClassRunner Test clashes with SpringBootTest

I have a bunch of tests in my project that are all annotated with @SpringBootTest and therefore load up a SpringBoot context. Now recently I refactored a Test in which I wanted a smaller scope (it´s about process coverage with camunda) to…
BFR
  • 105
  • 1
  • 1
  • 9
1
vote
0 answers

spring contextconfiguration using bean several times

Given a class that does some component testing. I want to mock the fooService.send only one times in the test and use it in aService and bService: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes =…
1
vote
2 answers

@SpringBootTest - failed to load applicationcontext

Test class: @RunWith(SpringRunner.class) @SpringBootTest public class FileInterfaceTest { @Test public void contextLoads() { } } Application : AppConfig: @Configuration @ImportResource({ "classpath:process-flows.xml" }) public…
1
vote
1 answer

JUnit for Spring WebServiceTemplate not working

I am consuming a SOAP Webservice using Spring WebServiceTemplate. While executing the JUnit I am facing an issue. My Client class: @Service public class MyWsClient extends WebServiceGatewaySupport { @Autowired private WebServiceTemplate…
1
vote
0 answers

Junit spring/jersey test does not commit queries via @Transaction

I have the following test code @Transactional @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:applicationContext.xml"}) public class LocationGroupControllerTest extends JerseyTest { private static final…
benstpierre
  • 32,833
  • 51
  • 177
  • 288
1
vote
1 answer

Why does JUnit 4.12 throw a NoSuchMethodError for assertEquals when using @RunWith(SpringJUnit4ClassRunner.class)?

A recent change in one of our webservices has added the requirement of using autowired beans in our tests however, I have not been able to get the @RunWith(SpringJUnit4ClassRunner.class) route everyone has suggested to work. When I add that…
SitchBlap
  • 13
  • 5
1
vote
2 answers

Start JUnit test with fresh Spring Context

I wrote two unit test classes using JUnit4. They both run fine separately, but running them one after another (by for example mvn test), the second test fails. The reason the second test fails is because the first test modified a bean in the first…
Vjeetje
  • 5,314
  • 5
  • 35
  • 57
1
vote
2 answers

jdbc update query no working on unit test with derby database and SpringJUnit4ClassRunner

I am having problems trying to do an unit test. The test class is simple like: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"/job-runner-context.xml}) public class AtualizarDataServiceTest { @Autowired …
1
vote
1 answer

Service object not mocked with data?

Service object not mocked from controller testcase return empty object here is the below code @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Main.class) @WebAppConfiguration …
Venkata Rama Raju
  • 1,325
  • 2
  • 10
  • 15
1
vote
1 answer

Is it still true that SpringJUnit4ClassRunner can't reliably call DisposableBean.destroy after tests

According to: https://jira.spring.io/browse/SPR-4103 SpringJUnit4ClassRunner won't always called DisposableBean.destroy after tests (*facepalm*!) -- due to implementation problems with JUnit. Is this still true? I'm creating tests in scala like…
user48956
  • 14,850
  • 19
  • 93
  • 154
0
votes
1 answer

unable to mock RestTemplate response

I wanted to mock the RestTemplate's result, but with my code below, it always went to do the Http. Can someone please advise? I think I have parts that I did wrongly, please help. UserServiceTest.java @RunWith(SpringJUnit4ClassRunner.class) public…
xxestter
  • 441
  • 7
  • 19
0
votes
1 answer

maven does not detect tests from the command line

I have a Spring MVC project (an application framework and inversion of control container for the Java platform) with this test: @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(locations = { …