SetupAttributeParser implements SdpParser<SetupAttribute> { @Override public SetupAttribute parse(String sdp) throws SdpException { try { return new SetupAttribute(sdp.trim().substring(8)); } catch (Exception e) { throw new SdpException(PARSE_ERROR + sdp, e); } }  @Override boolean canParse(String sdp); @Override SetupAttribute parse(String sdp); @Override void parse(SetupAttribute field, String sdp);  }
@Test public void testParse() throws SdpException { String sdp1 = "a=setup:active\n\r"; SetupAttribute obj = PARSER.parse(sdp1); Assert.assertNotNull(obj); Assert.assertEquals("active", obj.getValue()); }
@Test public void testParseOverwirte() throws SdpException { String sdp1 = "a=setup:active\n\r"; String sdp2 = "a=setup:passive\n\r"; SetupAttribute obj = PARSER.parse(sdp1); PARSER.parse(obj, sdp2); Assert.assertEquals("passive", obj.getValue()); }
@Test(expected = SdpException.class) public void testParseMissingRole() throws SdpException { String sdp1 = "a=setup:\n\r"; PARSER.parse(sdp1); }
@Test(expected = SdpException.class) public void testParseInvalidRole() throws SdpException { String sdp1 = "a=setup:other"; PARSER.parse(sdp1); }