Skip to content
a kata for practicing both testing with Combination Approvals and 'Split Phase' refactoring
Java Python C#
Branch: master
Clone or download
emilybache Merge pull request #1 from MatteoPierro/fix-readme-typo
fix 'database' typo in the readme
Latest commit 0d142be Aug 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
csharp initial import Aug 5, 2019
java tweak logic so we get Queen range eyeshadow products Aug 5, 2019
python first draft of python version Aug 5, 2019
.gitignore ignore received files Aug 5, 2019

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.

You can’t perform that action at this time.