SessionNameFieldParser implements SdpParser<SessionNameField> { @Override public boolean canParse(String sdp) { if(sdp == null || sdp.isEmpty()) { return false; } return PATTERN.matcher(sdp.trim()).matches(); }  @Override boolean canParse(String sdp); @Override SessionNameField parse(String sdp); @Override void parse(SessionNameField field, String sdp);  }
@Test public void testCanParse() { String validLine1 = "s=xyz\n\r"; String validLine2 = "s= \n\r"; String validLine3 = "s=\n\r"; String validLine4 = "s= \n\r"; boolean canParseValidLine1 = parser.canParse(validLine1); boolean canParseValidLine2 = parser.canParse(validLine2); boolean canParseValidLine3 = parser.canParse(validLine3); boolean canParseValidLine4 = parser.canParse(validLine4); Assert.assertTrue(canParseValidLine1); Assert.assertTrue(canParseValidLine2); Assert.assertTrue(canParseValidLine3); Assert.assertTrue(canParseValidLine4); }