no

Spring Boot 2 and Assert with JUnit5 and Mockito

I. Introduction With the recent release of Spring 2.2.0, it is now loaded with JUnit5. What I personally like with this version is the...

I. Introduction

With the recent release of Spring 2.2.0, it is now loaded with JUnit5. What I personally like with this version is the transition to Java 8, which means Lambda expressions are now supported. And it doesn’t hurt to update as JUnit5 is backward compatible. That means that old tests will still run and update can be gradual.

II. Creating the Spring Boot Project

Using the Spring STS IDE perform the following:
  1. Create a new project using the Spring Starter Project template.
  2. Add the following dependencies:
    -spring-boot-starter-web
    -spring-boot-starter-data-jpa
    -spring-boot-devtools
    -h2
    -lombok
  3. Add plugin maven-surefire-plugn
  4. Add the following properties to your application.properties file:
    -spring.main.allow-bean-definition-overriding=true
    -spring.jpa.hibernate.ddl-auto=create-drop
  5. Create the entity, repository and service classes available at the end of this blog.

III. Java Class and Configuration Files

IV. References

Related

coding 4383224737434370570

Post a Comment Default Comments

item