01: /*
02: * Conditions Of Use
03: *
04: * This software was developed by employees of the National Institute of
05: * Standards and Technology (NIST), and others.
06: * This software is has been contributed to the public domain.
07: * As a result, a formal license is not needed to use the software.
08: *
09: * This software is provided "AS IS."
10: * NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
11: * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
12: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
13: * AND DATA ACCURACY. NIST does not warrant or make any representations
14: * regarding the use of the software or the results thereof, including but
15: * not limited to the correctness, accuracy, reliability or usefulness of
16: * the software.
17: *
18: *
19: */
20: /*
21: * Created on Jul 25, 2004
22: *
23: *The Open SLEE project
24: */
25: package test.unit.gov.nist.javax.sip.parser;
26:
27: import gov.nist.javax.sip.address.*;
28: import gov.nist.javax.sip.parser.*;
29: import java.text.ParseException;
30:
31: /**
32: *
33: */
34: public class AddressParserTest extends ParserTestCase {
35:
36: public void testParser() {
37:
38: String[] addresses = {
39: "<sip:user@example.com?Route=%3csip:sip.example.com%3e>",
40: "\"M. Ranganathan\" <sip:mranga@nist.gov>",
41: "<sip:+1-650-555-2222@ss1.wcom.com;user=phone>",
42: "M. Ranganathan <sip:mranga@nist.gov>" };
43: try {
44: for (int i = 0; i < addresses.length; i++) {
45: AddressParser addressParser = new AddressParser(
46: addresses[i]);
47: AddressImpl addr = addressParser.address();
48: assertEquals(addr, new AddressParser(addr.encode())
49: .address());
50: }
51: } catch (ParseException ex) {
52: fail(this.getClass().getName());
53: }
54:
55: }
56:
57: }
|