GithubHelp home page GithubHelp logo

paulasanchez810 / spring-boot-tdd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ada-school/spring-boot-tdd

0.0 1.0 0.0 18 KB

Implement a REST API following TDD principles.

License: MIT License

Java 100.00%

spring-boot-tdd's Introduction

Spring Boot TDD

Learning Objectives

  • Explain what TDD is.
  • Implement Unit Test using JUnit & Mockito.
  • Implement a REST API using TDD.

Be Proactive 🤹🏽

Watch the following video How to be Proactive in Life

Main Topics

  • TDD.
  • Unit Test.
  • Mock.

Codelab 🧪

🗣️ "I hear and I forget I see and I remember I do and I understand." Confucius

Part 1: Verify that your test fail

In TDD you first implement the test then you write the code to achieve the test expected results.This time you will start by runing existing test and then write the code to pass the test.

  1. Download and sync the project in the repo.
  2. Open the class MongoWeatherServiceTest and run the tests.
  3. Read the results and check the code to find what is wrong.

Part 2: Write to the code to pass the test

  1. Implement the code so your tests pass.
  2. Run your test again and verify that they all pass.

Part 3: Implementing Unit Tests for MongoWeatherService

  1. Write 1 unit test for each method of the WeatherService to verify the correct implementation on the * MongoWeatherService*.

Part 4: Testing your Rest Controller

  1. Open the HealthControllerTest class and run the tests.
  2. Check the code and understand how to use the Spring Boot testing annotation.
  3. Create a new class to test the WeatherReportController called WeatherReportControllerTest.
  4. Copy the configuration annotations you will need from the HealthControllerTest class.
  5. Implement 1 unit test for each method inside the WeatherReportController.

spring-boot-tdd's People

Contributors

sancarbar avatar

Watchers

James Cloos 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.