Spring boot application is not picking all the test cases for execution after migrating spring boot 2.5.12 - spring

We have spring-boot application ,when we try to run unit tests it seems that some of the unit tests cases are not picking for execution.
This issue started happening after upgrading spring boot version from 2.3.9 to 2.5.12
We are using java 11,gradle 6.8 and gradle dependency testCompile 'junit:junit:4.12'
Any reason of not picking all the test cases for execution?

Check the Spring Boot 2.4 release notes regarding JUnit 5:
If you do not want to migrate your tests to JUnit 5 and wish to continue using JUnit 4, add a dependency on the Vintage Engine
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.4-Release-Notes#junit-5s-vintage-engine-removed-from-spring-boot-starter-test

Related

Can GraphQL server be built with Spring Boot version less than 2.x?

I am adding GraphQL schema wiring to my legacy microservices. I want to embed the wiring inside each of the spring boot services; The challenge I am running into is my project's Spring boot version is 1.4.5 RELEASE and moving it up to 2.x runs into others issues and would be ideal if I can get a basic graphql schema wiring done without updating version to 2.x. I see from documentation that minimal Spring boot version needed is 2.2.x in articles like this:
https://www.graphql-java.com/tutorials/getting-started-with-spring-boot/
According to the gradle build file for the graphql-java-spring library (https://github.com/graphql-java/graphql-java-spring/blob/master/build.gradle) the oldest supported Spring versions are:
springVersion = "5.1.2.RELEASE"
springBootVersion = "2.1.0.RELEASE"
You can try to compile it with an earlier spring boot version, but there is probably a lot of work to do.

spring integration data-redis and data-jpa version compare my project data-redis and data-jpa version

In a project developed with Spring boot 1.5.7, data-redis and data-jpa was used. Data-jpa version is 1.11.7, data-redis version is 1.8.7. I need to add spring-integration to the project. I will use version 4.3.12. data-jpa version in this version is 1.10.10, data-redis version is 1.7.10.
It is not the same as the data-redis and data-jpa versions used in the project.
What problems can this cause ?
That can't cause any problem as far as you don't override any dependencies provided by Spring Boot. You really should just rely on the well-tested composition of dependencies represented in Spring Boot. Even if Spring Integration 4.3.12 brings Spring Data JPA 1.10.10 as a transitive dependency that doesn't mean that it is not overridden by Spring Boot.
I'm not sure which do to point you out, but one of the main goals in Spring Boot is to bring into the target project consistency and cross-compatibility in the dependencies part.
This might help you a bit: https://docs.spring.io/spring-boot/docs/2.0.3.RELEASE/reference/htmlsingle/#using-boot-dependency-management

IllegalStateException at start up Spring JUnit test

I've made a simple Maven Spring REST project. (this one: https://spring.io/guides/gs/rest-service/)
Afterwards I made a simple JUnit test using MockMVC to test the REST functionality. In this case: does my code respond to /greeting?
When I run my test (using IntelliJ) I get this IllegalStateException.
How can I resolve this?
You're probably using incompatible versions of spring-test and spring-boot. spring-test calls SpringApplicationContextLoader.getResourceSuffixes (plural form) since v4.1.0.RC2. spring-boot's SpringApplicationContextLoader.getResourceSufffix (singular) throws that exception since v1.3.0.RC1.
You would have to either upgrade to spring-test >= 4.1.0 or downgrade to spring-boot < 1.3.0

Spring boot embedded container

We have to deploy our code to WAS 7.0. We have got our spring boot application to deploy to WAS.
WAS 7.0 uses the Servelet 2.5 spec and we have to use java 1.6 jdk.
I am having issues with running the junit / integration tests. The embedded container is a tomcat 7. Can I run the tests using a lower version of tomcat or jetty.
JHipster is based on Spring Boot, so it has its requirements as a minium.
You will need a Servlet 3.0 container
It's going to be difficult to have it work on JDK6
The whole point of JHipster is to have a "modern" application, so making it work on Websphere and JDK6 isn't our original goal.

Using JMockit and TestNG with Spring framework

Spring framework has great integration with jUnit and EasyMock. Does anyone have experience using JMockit and TestNG with Spring framework?
I have experience with TestNG with Spring framework. spring-test.jar library helps to integrate TestNG and JUnit by the way with Spring for testing purposes. If you use JMockit or not should not affect the way you use TestNG-SprintTest-Spring integration.

Resources