Partition Testing for catWhiteSpace
publish date: 2026/06/19 10:41:43.865487 UTC
A method called catWhiteSpace is part of a 'Paragraph' object. Within a paragraph, it replaces sequences of blank characters with a single blank character. For example, 'Hello World' becomes 'Hello World'. Which of the following correctly identifies the input partitions for testing this method? Select all that apply.
Correct Answer
Explanation
Valid partitions for catWhiteSpace include: (1) no blanks - nothing to collapse; (2) single blanks between words - already compressed, should be unchanged; (3) multiple consecutive blanks - the primary transformation case; (4) empty paragraph - edge case; (5) all blanks - should become a single blank; (6) leading blanks only; (7) trailing blanks only. Each partition exercises a different behavioral path in the method.
Reference
Software Engineering, Ian Sommerville, 10th edition
