### Question:
Attribute implements Cloneable { public static Attribute parse(String line) throws ParseException { Matcher m = parsePattern.matcher(line); if (!m.find()) throw new ParseException("not a valid attribute record", 0); return new Attribute(m.group(1), m.group(3)); } Attribute(String name, String value);  Attribute(String name); String getName(); void setName(String name); String getValue(); void setValue(String value); @Override String toString(); @Override Attribute clone(); static Attribute parse(String line);  }### Answer:
@Test public void testParse() throws ParseException { System.out.println("SDP attribute parse test..."); String[] attributes = new String[] { "a=key1:value", "a=key2", " a=key", "a =key", "a = key", "a=key :value", "a=:value", }; int i = 0; Attribute a = Attribute.parse(attributes[i++]); assertEquals("key1", a.getName()); assertEquals("value", a.getValue()); a = Attribute.parse(attributes[i++]); assertEquals("key2", a.getName()); assertNull(a.getValue()); for (; i < attributes.length; i++) { try { Attribute.parse(attributes[i]); fail("attribute: \"" + attributes[i] + "\" parsed without an exception"); } catch (ParseException ex) { } } }