IcePwdAttributeParser implements SdpParser<IcePwdAttribute> { @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 IcePwdAttribute parse(String sdp); @Override void parse(IcePwdAttribute field, String sdp);  }
@Test public void testCanParse() { String sdp1 = "a=ice-pwd:P4ssW0rD\n\r"; String sdp2 = "a=ice-pass: \n\r"; String sdp3 = "x=ice-pwd:P4ssW0rD\n\r"; boolean canParseSdp1 = parser.canParse(sdp1); boolean canParseSdp2 = parser.canParse(sdp2); boolean canParseSdp3 = parser.canParse(sdp3); Assert.assertTrue(canParseSdp1); Assert.assertFalse(canParseSdp2); Assert.assertFalse(canParseSdp3); }