COMP 4004 Lecture Notes - Lecture 1: Junit, Xunit, Code Smell
Document Summary
Obtuse assertions look bad and are hard to understand. Instead of hard wiring everything, build test objects: meszaros says as soon as you are into creating test objects, need to decide how far you go. All these are non-trivial and can get complicated with trade offs. Is good in sense it shows that your checking all values are being checked but below have no idea if everything is being checked below. And not necessarily more reusable as you may have some case you just want to check the discount. Introduce custom assert: nothing changes, just moved somewhere else so the test is better looking. Just refactoring style which is not part of fowlers book: one code smell is putting test logic in production code. Or: expectedpoint. setx(17. 0); expectedpoint. sety(9. 0), guard assertion, conditional test logic creates multiple execution paths thru test, this makes tests hard to verify.