### Eclipse Workspace Patch 1.0
#P josm
diff --git test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java
index a4185d3..6898333 100644
--- test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java
+++ test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java
@@ -374,4 +374,111 @@
             originalBusStop.data.remove(duplicateKey);
         }
     }
+    
+    /**
+     * Tests value harmonization (e.g. case normalization and trimming) resulting in a valid preset match.
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    void testTryGuessHarmonizedMatch() throws IOException {
+        final List<TestError> errors = test(OsmUtils.createPrimitive("way highway=\"Residential \""));
+        assertEquals(1, errors.size());
+        final TestError error = errors.get(0);
+        assertEquals(Severity.WARNING, error.getSeverity());
+        assertEquals(TagChecker.MISSPELLED_VALUE, error.getCode());
+        assertTrue(error.getDescription().contains("maybe 'residential' is meant?"));
+    }
+
+    /**
+     * Tests a single unambiguous typo corrected via Levenshtein distance.
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    void testTryGuessSingleLevenshteinMatch() throws IOException {
+        final List<TestError> errors = test(OsmUtils.createPrimitive("way highway=residentail"));
+        assertEquals(1, errors.size());
+        final TestError error = errors.get(0);
+        assertEquals(Severity.WARNING, error.getSeverity());
+        assertEquals(TagChecker.MISSPELLED_VALUE, error.getCode());
+        assertTrue(error.getDescription().contains("maybe 'residential' is meant?"));
+    }
+
+    /**
+     * Tests a misspelled value that has multiple equally close preset candidates.
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    void testTryGuessMultipleLevenshteinMatches() throws IOException {
+        // "radh" (length 4) has a Levenshtein distance of 2 to both "path" and "road"
+        final List<TestError> errors = test(OsmUtils.createPrimitive("way highway=radh"));
+        assertEquals(1, errors.size());
+        final TestError error = errors.get(0);
+        assertEquals(Severity.WARNING, error.getSeverity());
+        assertEquals(TagChecker.MISSPELLED_VALUE_NO_FIX, error.getCode());
+        assertTrue(error.getDescription().contains("maybe one of ["));
+    }
+
+    /**
+     * Tests that short values do not trigger false typo suggestions when length differences are too large.
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    void testTryGuessShortValueGuard() throws IOException {
+        final List<TestError> errors = test(OsmUtils.createPrimitive("way surface=u"));
+        assertEquals(1, errors.size());
+        final TestError error = errors.get(0);
+        assertEquals(Severity.OTHER, error.getSeverity());
+        assertEquals(TagChecker.INVALID_VALUE, error.getCode());
+    }
+
+    /**
+     * Tests that short values with no matching characters are reported as unknown instead of misspelled.
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    void testTryGuessCompletelyDifferentShortValue() throws IOException {
+        final List<TestError> errors = test(OsmUtils.createPrimitive("node amenity=parking fee=10"));
+        assertEquals(1, errors.size());
+        final TestError error = errors.get(0);
+        assertEquals(Severity.OTHER, error.getSeverity());
+        assertEquals(TagChecker.INVALID_VALUE, error.getCode());
+    }
+
+    /**
+     * Tests an unknown tag value that does not match any preset within the allowed Levenshtein distance.
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    void testTryGuessUnknownValue() throws IOException {
+        final List<TestError> errors = test(OsmUtils.createPrimitive("way highway=completely_unknown_value"));
+        assertEquals(1, errors.size());
+        final TestError error = errors.get(0);
+        assertEquals(Severity.OTHER, error.getSeverity());
+        assertEquals(TagChecker.INVALID_VALUE, error.getCode());
+    }
+
+    /**
+     * Test that keys listed in {@code ignoreForLevenshtein} do not trigger a typo suggestion,
+     * even if the unknown value has a small Levenshtein distance to a preset value.
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    @Test
+    void testTryGuessIgnoredKey() throws IOException {
+        // 'couplings' has numerical preset values (e.g. 1, 2) and is in ignoreForLevenshtein.
+        // Value "11" has Levenshtein distance 1 to "1", so no typo suggestion should be made.
+        final List<TestError> ignoredErrors = test(OsmUtils.createPrimitive("node emergency=fire_hydrant couplings=11"));
+        assertEquals(1, ignoredErrors.size());
+        final TestError error = ignoredErrors.get(0);
+        assertEquals(Severity.OTHER, error.getSeverity());
+        assertEquals(TagChecker.INVALID_VALUE, error.getCode());
+        assertEquals("Presets do not contain property value", error.getMessage());
+        assertEquals("Value '11' for key 'couplings' not in presets.", error.getDescription());
+    }
 }
