### Question:
Key implements Cloneable { public static Key parse(String line) throws ParseException { Matcher m = parsePattern.matcher(line); if (!m.find()) throw new ParseException("not a valid key record", 0); return new Key(m.group(1), m.group(3)); } Key(String method, String key); String getKey(); void setKey(String key); String getMethod(); void setMethod(String method); @Override String toString(); @Override Key clone(); static Key parse(String line);  }### Answer:
@Test public void testParse() throws ParseException { System.out.println("SDP key parse test..."); String[] keys = new String[] { "k=tm:tk", "k=prompt", " k=tm", "k =tm", "k = tm", "k=tm :tk", "k=:tk", }; int i = 0; Key k = Key.parse(keys[i++]); assertEquals("tm", k.getMethod()); assertEquals("tk", k.getKey()); k = Key.parse(keys[i++]); assertEquals("prompt", k.getMethod()); assertNull(k.getKey()); for (; i < keys.length; i++) { try { Key.parse(keys[i]); fail("key: \"" + keys[i] + "\" parsed without an exception"); } catch (ParseException ex) { } } }