Questions tagged [springjunit4classrunner]

55 questions
0
votes
2 answers

SpringJunit4Runner no tests found

I have written a framework using springboot and junit4 but the tests are not found with the below error. Console logs show the below error: Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.61 sec <<<…
SlickTester
  • 129
  • 1
  • 3
  • 15
0
votes
0 answers

How to write junit for RabbitListenerEndpointRegistry in spring framework

I have rest controller to start/stop rabbitmq QUEUE. That is working fine. But i need to write junit for this rest controller. I have done the junit as well but that does not looks good. I am not sure how better we can write junit for this rest…
mike
  • 377
  • 1
  • 9
  • 22
0
votes
2 answers

I have an apache camel test case which is failing because of different object instances getting created. The object instances are having different IDs

Following is the error which I am getting - java.lang.AssertionError: mock://send Body of message: 0. Expected: but was:…
0
votes
2 answers

SpringBoot integration tests failing with java.awt.HeadlessException

Updates after review and proposal from @Bobernac Alexandru The question is updated with proposals, you can just use it directly ;) I have an issue while running Springboot integration tests. My test class public class DepenseEndpointIT extends…
0
votes
0 answers

Spring 4, JUnit 4 without spring boot NoSuchBeanDefinitionException: No qualifying bean of type

I have a Spring 4.3 application which works fine. I'm trying to use JUnit 4.11 but the context doesn't load. Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type …
0
votes
1 answer

Spring configuration via code vs. configuration via annotations

I create Spring ApplicationContext via code like the following: public static AnnotationConfigWebApplicationContext startContext(String activeProfile, PropertySource propertySource, Class... configs) { …
0
votes
1 answer

when to create objects using new operator or use auto-wire when testing a class?

The class that I want to test is called UserService with sendEmail method, which sends an email to user. To accomplish this task it depends on EmailService. Now when writing a testcase to test this - should I create UserService userService = new…
tech_questions
  • 263
  • 5
  • 14
0
votes
1 answer

junit test case for spring-integration-file

Am newbie to Spring. I have a spring project created using spring-integration-file (spring boot- FTP,SFTP,NFS) which will transform the file from source path to destination path. Have to write junit test cases to test the project. It will be helpful…
0
votes
1 answer

Unit testing with SpringJUnit4ClassRunner using only @Component and @Autowired

I have the following class: @Component public class MyClass { @Autowired MyPojo pojo; } How do i test it without mocking the injected beans? I do not have a configuration [XML or declarative]. I have done the…
Akhil Alluri
  • 13
  • 1
  • 6
0
votes
1 answer

springboottest how to prevent running application

I have the standard Application class which runs a Spring batch ETL: @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } with my Junit test…
Micho Rizo
  • 1,000
  • 3
  • 12
  • 27
0
votes
1 answer

Spring Boot Main class Junit test throwing error

this is the Spring boot main class @SpringBootApplication @EnableDiscoveryClient public class Application { private static final Logger LOGGER = LoggerFactory.getLogger(Application.class); public static void main(String[] args) { …
Sree Kanth
  • 59
  • 1
  • 8
0
votes
1 answer

Profiles with @RunWith(SpringJUnit4ClassRunner.class)

I have two configurations for my TestSuite which provide a different beans for injection. This works so long as I set my profile with an annotation. @ActiveProfiles( profiles={"a"}) and @ActiveProfiles( profiles={"b"}) But I seem unable to set it…
Christopher Hackett
  • 6,042
  • 2
  • 31
  • 41
0
votes
1 answer

Injecting specific bean to DAO using Spring profile

In my webapplication there are two datasource beans in the applicationContext one is to be used for real-env and one is to be used for execution of test. The dataSource objects is injected in one DAO class. Using Spring profile how can I configure…
0
votes
1 answer

DBunit data is not visible in Oracle

In my project we are using xml files to insert data into Database(oracle).But, I am not getting where this data is inserted in DB.I am seeing insert statements while executing query. But data is not visible in DB. While retrieving, the data is…
0
votes
1 answer

Cannot setup Mock Class in Spring

I'm coming onto a project that a suite of Integration tests. One of these tests autowired a class that did a lot of network calls to a 3rd party vendor. Because we didn't want our tests to make these calls, the team mocked out this client via a…
IcedDante
  • 6,145
  • 12
  • 57
  • 100