android_catalogue1-10 Exercise 2: Tests and a Deliberate Break =============================================================== Run: right-click PureRulesTest and choose Run. Expected: all tests pass (green). Breaking it: delete the line .replace("\\", "\\\\") from likePattern. Then wildcardsInTheQueryAreEscaped fails on its THIRD assertion: expected:<%a\b%> but was:<%a\b%> (The first two assertions still pass: they do not involve a backslash in the input.) The message shows exactly the difference: the backslash in the user's text was not doubled, so in the LIKE pattern it would be read as an escape character for the next letter. Without the test, this bug would show only for a title containing a backslash and would be very hard to notice. Put the line back and re-run: green. Your own test: any rule will do. Examples that need no Android: @Test fun yearRangeIsValidated() { assertTrue(FormUiState(title = "x", typeId = 1, yearText = "").isValid) assertFalse(FormUiState(title = "x", typeId = 1, yearText = "12").isValid) assertFalse(FormUiState(title = " ", typeId = 1).isValid) } (FormUiState's validity properties are plain Kotlin, so this is a fast local test.) Or an instrumented one: saving an item with a type id that does not exist should fail because of the foreign key. Tip: name tests as sentences describing the rule. A failing test then tells you which rule broke.