SessionNameFieldParser implements SdpParser<SessionNameField> { @Override public SessionNameField parse(String sdp) throws SdpException { try { return new SessionNameField(sdp.trim().substring(2)); } catch (Exception e) { throw new SdpException(PARSE_ERROR + sdp, e); } }  @Override boolean canParse(String sdp); @Override SessionNameField parse(String sdp); @Override void parse(SessionNameField field, String sdp);  }
@Test public void testParse() throws SdpException { String line = "s=xyz\n\r"; SessionNameField field = parser.parse(line); Assert.assertEquals("xyz", field.getName()); }
@Test public void testParseOverwrite() throws SdpException { String line1 = "s=xyz\n\r"; String line2 = "s=abc\n\r"; SessionNameField field = parser.parse(line1); parser.parse(field, line2); Assert.assertEquals("abc", field.getName()); }