claremacrae / ValidateAndAddProduct-Refactoring-Kata

a kata for practicing both testing with Combination Approvals and 'Split Phase' refactoring

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValidateAndAddProduct Refactoring Kata

This refactoring kata mixes logic for both validating input data and creating a new product in the database. It might be valuable to separate these two into separate 'Phases' (see Martin Fowler's 'Split Phase' refactoring) Before you refactor it, you will want some better test cases. There is one test case to start you off - using an Approval Testing framework. See the Approval Tests website.

The change you need to make

The reason for the refactoring is that you need to add a new type of product - Lip gloss. It should behave the same as the 'Lipstick' type with a small difference - if the price is greater than 10 it should be put in the 'Queen' range instead of the 'Professional' range. If the weight is over 20 then you should return an error.

The 'with_tests' branch

If you want to go straight for the refactoring, you can find a good set of tests in the 'with_tests' branch. They use a Combination Approvals approach.

About

a kata for practicing both testing with Combination Approvals and 'Split Phase' refactoring

License:MIT License


Languages

Language:Java 28.3%Language:C++ 27.5%Language:C# 24.5%Language:Python 17.5%Language:CMake 2.2%