GithubHelp home page GithubHelp logo

springboot-webmvc-example's Introduction

WebMVC test example

What is covered in this example?

You can find the following examples:

  1. How to mock DB for tests. There is configured MySQL DB for main project and in memory H2 DB for tests.
  2. How to send POST request to you controller and validate the response
  3. How to send GET request, receive the response object and validate the response
  4. How to test custom repository method. See UserRepositoryTest class

How to launch?

  1. Replace your MySQL connection properties in the src/main/resources/application.properties
  2. Run project

How to check tests works?

  1. Run all tests from `src/test/java

Important

  1. PLease note we are not using service layer in this example. This example is required to show of how to test the controller layer.
  2. Please note we are performing the business logic in the controller. Don't do it in your test tasks or in real projects.

springboot-webmvc-example's People

Contributors

boroda4436 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.