### Question:
StringUtils { public static int getLevenshteinDistance(CharSequence s, CharSequence t) { if (s == null || t == null) { throw new IllegalArgumentException("Strings must not be null"); } int n = s.length(); int m = t.length(); if (n == 0) { return m; } else if (m == 0) { return n; } if (n > m) { final CharSequence tmp = s; s = t; t = tmp; n = m; m = t.length(); } final int p[] = new int[n + 1]; int i; int j; int upper_left; int upper; char t_j; int cost; for (i = 0; i <= n; i++) { p[i] = i; } for (j = 1; j <= m; j++) { upper_left = p[0]; t_j = t.charAt(j - 1); p[0] = j; for (i = 1; i <= n; i++) { upper = p[i]; cost = s.charAt(i - 1) == t_j ? 0 : 1; p[i] = Math.min(Math.min(p[i - 1] + 1, p[i] + 1), upper_left + cost); upper_left = upper; } } return p[n]; }  static int getLevenshteinDistance(CharSequence s, CharSequence t);  }### Answer:
@Test public void testGetLevenshteinDistance_StringString() { assertEquals(0, StringUtils.getLevenshteinDistance("", "")); assertEquals(1, StringUtils.getLevenshteinDistance("", "a")); assertEquals(7, StringUtils.getLevenshteinDistance("aaapppp", "")); assertEquals(1, StringUtils.getLevenshteinDistance("frog", "fog")); assertEquals(3, StringUtils.getLevenshteinDistance("fly", "ant")); assertEquals(7, StringUtils.getLevenshteinDistance("elephant", "hippo")); assertEquals(7, StringUtils.getLevenshteinDistance("hippo", "elephant")); assertEquals(8, StringUtils.getLevenshteinDistance("hippo", "zzzzzzzz")); assertEquals(8, StringUtils.getLevenshteinDistance("zzzzzzzz", "hippo")); assertEquals(1, StringUtils.getLevenshteinDistance("hello", "hallo")); }
@Test(expected = IllegalArgumentException.class) public void testGetLevenshteinDistance_NullString() throws Exception { StringUtils.getLevenshteinDistance("a", null); }
@Test(expected = IllegalArgumentException.class) public void testGetLevenshteinDistance_StringNull() throws Exception { StringUtils.getLevenshteinDistance(null, "a"); }