Skip to content

RamonBecker/SpringJUNITAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpringJUNITAPI

ℹ️ Information

Project developed with Spring Boot, Spring Data JPA, Hibernate, Mockito, JUnit 5 and H2 Database. The DTO (Data Transfer Objects) and MVC standards were used. I'll leave my POSTMAN collections in the repository for consumption by the project endpoints.

Some features developed:

  • Creation of a user CRUD Rest API;

  • Automated tests with 100% project code coverage;

  • Validations with Spring Validation;

  • Using Lombok and ModelMapper to eliminate boilerplate code

  • Implementation of test and development profiles;

  • Custom exception handling

⚠️ Prerequisite

Java Badge >= 17

Spring Badge

Spring Boot Badge

JSON Badge

h2-logo-2 (1)

JSON Badge

JPA-hibernate (1)

Postman Badge OR Insomnia Badge

🔧 Install

git clone https://github.com/RamonBecker/SpringJUNITAPI.git

git clone https://github.com/RamonBecker/SpringJUNITAPI.git
or install github https://desktop.github.com/ 

🔨 POSTMAN

To test the end points you will need to install POSTMAN or Insomnia. I recommend installing POSTMAN. I'll leave the collections on the DRIVE to facilitate testing.

Download and import collections into your POSTMAN:

https://drive.google.com/file/d/1cxAaM5MhwwDUdmilla_Fh3jb6JKufJq6/view?usp=sharing

⚙️ Testing the project

To test the project you will need to clone the repository on your machine. You can choose both tools: postman or insomnia.

To download postman go to the following link: https://www.postman.com/downloads/
To download insomnia rentre from the following link: https://insomnia.rest/download

Remembering that you must choose the operating system corresponding to your machine. After you have made your registration in these tools, run them and you must type the following in the address:

localhost:8080/user/

according to the image below, to perform, for example, the GET operation, to search for all users in the database.

The following HTPP methods were implemented: PUT, DELETE, GET and POST.

The example was performed using Postman.

teste

Accessing the H2 database

If you want to modify the user to access the database, modify the application.properties file. Change the following:

spring.datasource.username=user
spring.datasource.password=password

Access in browser

http://localhost:8080/h2-console

If the JDBC URL is not configured, replace it with:

jdbc:h2:mem:testdb

h2

⚡ Technologies

  • Java
  • JPA
  • Hibernate
  • Spring Boot
  • H2 Database
  • Design Pattern MVC
  • Design Pattern DTO
  • Lombok
  • Mockito
  • JUnit 5

📝 Developed features

  • CRUD User
  • Automated tests for the Rest API

🧑‍💻 Author

By Ramon Becker 👋🏽 Get in touch!

github linkedin Gmail Badge

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages