Giter VIP home page Giter VIP logo

tddwithjunit's Introduction

JUnit Testing

This repository contains a project for Eclipse that lets you explore test-driven development. It uses the JUnit 4 testing library.

Clone this repository and import the project into Eclipse.

How to use this

The src/Car.java class contains a simple class representing a car, and a few methods are already implemented. You'll use test-driven development to add some new features to the class.

The src/CarTest.java file contains unit tests for the existing functionality of the Car object, but you'll need to add more.

Things To Do

  1. Implement the toString() method of Car by using the existing unit test as a guide. Return a string that matches the expectation of the test.

  2. Implement the decelerate() method of Car by writing a unit test first. Ensure that when you call the decelerate() method and pass an amount as its argument, that the speed property decreases by that amount.

  3. Write another test that ensures that you can't decelerate more than 0. Then modify the implementation of the decelerate() method so that new test passes.

Rules

  1. Do not write any code unless it's to make a failing test pass.
  2. Do not write any more of a unit test than is sufficient to fail, and not compiling is failing.
  3. Do not write more code in the Car class than you need to make the current unit test pass.

tddwithjunit's People

Contributors

ortish avatar napcs avatar

Watchers

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