001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Alexey A. Ivanov
019: * @version $Revision$
020: */package javax.swing.text.html;
021:
022: import java.net.URL;
023:
024: import javax.swing.BasicSwingTestCase;
025: import javax.swing.text.MutableAttributeSet;
026: import javax.swing.text.SimpleAttributeSet;
027: import javax.swing.text.StyleContext;
028: import javax.swing.text.html.HTML.Attribute;
029: import javax.swing.text.html.HTML.Tag;
030:
031: public class HTMLTest extends BasicSwingTestCase {
032:
033: // public void testHTML() {
034: // }
035:
036: public void testGetAllTags() {
037: final Tag[] expected = {
038: Tag.A,
039: Tag.ADDRESS,
040: Tag.APPLET,
041: Tag.AREA,
042: Tag.B,
043: Tag.BASE,
044: Tag.BASEFONT,
045: Tag.BIG,
046: Tag.BLOCKQUOTE,
047: Tag.BODY,
048: Tag.BR,
049: Tag.CAPTION,
050: Tag.CENTER,
051: Tag.CITE,
052: Tag.CODE,
053: //Tag.COMMENT,
054: //Tag.CONTENT,
055: Tag.DD, Tag.DFN, Tag.DIR, Tag.DIV, Tag.DL, Tag.DT,
056: Tag.EM, Tag.FONT, Tag.FORM, Tag.FRAME, Tag.FRAMESET,
057: Tag.H1, Tag.H2, Tag.H3, Tag.H4, Tag.H5,
058: Tag.H6,
059: Tag.HEAD,
060: Tag.HR,
061: Tag.HTML,
062: Tag.I,
063: Tag.IMG,
064: //Tag.IMPLIED,
065: Tag.INPUT, Tag.ISINDEX, Tag.KBD, Tag.LI, Tag.LINK,
066: Tag.MAP, Tag.MENU, Tag.META, Tag.NOFRAMES, Tag.OBJECT,
067: Tag.OL, Tag.OPTION, Tag.P, Tag.PARAM, Tag.PRE, Tag.S,
068: Tag.SAMP, Tag.SCRIPT, Tag.SELECT, Tag.SMALL, Tag.SPAN,
069: Tag.STRIKE, Tag.STRONG, Tag.STYLE, Tag.SUB, Tag.SUP,
070: Tag.TABLE, Tag.TD, Tag.TEXTAREA, Tag.TH, Tag.TITLE,
071: Tag.TR, Tag.TT, Tag.U, Tag.UL, Tag.VAR };
072:
073: Tag[] actual = HTML.getAllTags();
074: assertEquals(73, expected.length);
075: assertEquals(isHarmony() ? 91 : 74, actual.length);
076:
077: final boolean[] found = new boolean[expected.length];
078: for (int i = 0; i < expected.length; i++) {
079: for (int j = 0; j < actual.length; j++) {
080: if (expected[i] == actual[j]) {
081: found[i] = true;
082: break;
083: }
084: }
085: }
086:
087: for (int i = 0; i < found.length; i++) {
088: assertTrue("Tag " + expected[i] + " was not found, index "
089: + i, found[i]);
090: }
091: }
092:
093: public void testGetTag() {
094: assertNull(HTML.getTag("comment"));
095: assertNull(HTML.getTag(HTML.Tag.COMMENT.toString()));
096: assertNull(HTML.getTag("content"));
097: assertNull(HTML.getTag(HTML.Tag.CONTENT.toString()));
098: assertNull(HTML.getTag("p-implied"));
099: assertNull(HTML.getTag(HTML.Tag.IMPLIED.toString()));
100:
101: if (!isHarmony()) {
102: assertNotNull("nobr");
103: }
104:
105: assertSame(Tag.A, HTML.getTag("a"));
106: assertSame(Tag.ADDRESS, HTML.getTag("address"));
107: assertSame(Tag.APPLET, HTML.getTag("applet"));
108: assertSame(Tag.AREA, HTML.getTag("area"));
109: assertSame(Tag.B, HTML.getTag("b"));
110: assertSame(Tag.BASE, HTML.getTag("base"));
111: assertSame(Tag.BASEFONT, HTML.getTag("basefont"));
112: assertSame(Tag.BIG, HTML.getTag("big"));
113: assertSame(Tag.BLOCKQUOTE, HTML.getTag("blockquote"));
114: assertSame(Tag.BODY, HTML.getTag("body"));
115: assertSame(Tag.BR, HTML.getTag("br"));
116: assertSame(Tag.CAPTION, HTML.getTag("caption"));
117: assertSame(Tag.CENTER, HTML.getTag("center"));
118: assertSame(Tag.CITE, HTML.getTag("cite"));
119: assertSame(Tag.CODE, HTML.getTag("code"));
120: assertSame(Tag.DD, HTML.getTag("dd"));
121: assertSame(Tag.DFN, HTML.getTag("dfn"));
122: assertSame(Tag.DIR, HTML.getTag("dir"));
123: assertSame(Tag.DIV, HTML.getTag("div"));
124: assertSame(Tag.DL, HTML.getTag("dl"));
125: assertSame(Tag.DT, HTML.getTag("dt"));
126: assertSame(Tag.EM, HTML.getTag("em"));
127: assertSame(Tag.FONT, HTML.getTag("font"));
128: assertSame(Tag.FORM, HTML.getTag("form"));
129: assertSame(Tag.FRAME, HTML.getTag("frame"));
130: assertSame(Tag.FRAMESET, HTML.getTag("frameset"));
131: assertSame(Tag.H1, HTML.getTag("h1"));
132: assertSame(Tag.H2, HTML.getTag("h2"));
133: assertSame(Tag.H3, HTML.getTag("h3"));
134: assertSame(Tag.H4, HTML.getTag("h4"));
135: assertSame(Tag.H5, HTML.getTag("h5"));
136: assertSame(Tag.H6, HTML.getTag("h6"));
137: assertSame(Tag.HEAD, HTML.getTag("head"));
138: assertSame(Tag.HR, HTML.getTag("hr"));
139: assertSame(Tag.HTML, HTML.getTag("html"));
140: assertSame(Tag.I, HTML.getTag("i"));
141: assertSame(Tag.IMG, HTML.getTag("img"));
142: assertSame(Tag.INPUT, HTML.getTag("input"));
143: assertSame(Tag.ISINDEX, HTML.getTag("isindex"));
144: assertSame(Tag.KBD, HTML.getTag("kbd"));
145: assertSame(Tag.LI, HTML.getTag("li"));
146: assertSame(Tag.LINK, HTML.getTag("link"));
147: assertSame(Tag.MAP, HTML.getTag("map"));
148: assertSame(Tag.MENU, HTML.getTag("menu"));
149: assertSame(Tag.META, HTML.getTag("meta"));
150: assertSame(Tag.NOFRAMES, HTML.getTag("noframes"));
151: assertSame(Tag.OBJECT, HTML.getTag("object"));
152: assertSame(Tag.OL, HTML.getTag("ol"));
153: assertSame(Tag.OPTION, HTML.getTag("option"));
154: assertSame(Tag.P, HTML.getTag("p"));
155: assertSame(Tag.PARAM, HTML.getTag("param"));
156: assertSame(Tag.PRE, HTML.getTag("pre"));
157: assertSame(Tag.S, HTML.getTag("s"));
158: assertSame(Tag.SAMP, HTML.getTag("samp"));
159: assertSame(Tag.SCRIPT, HTML.getTag("script"));
160: assertSame(Tag.SELECT, HTML.getTag("select"));
161: assertSame(Tag.SMALL, HTML.getTag("small"));
162: assertSame(Tag.SPAN, HTML.getTag("span"));
163: assertSame(Tag.STRIKE, HTML.getTag("strike"));
164: assertSame(Tag.STRONG, HTML.getTag("strong"));
165: assertSame(Tag.STYLE, HTML.getTag("style"));
166: assertSame(Tag.SUB, HTML.getTag("sub"));
167: assertSame(Tag.SUP, HTML.getTag("sup"));
168: assertSame(Tag.TABLE, HTML.getTag("table"));
169: assertSame(Tag.TD, HTML.getTag("td"));
170: assertSame(Tag.TEXTAREA, HTML.getTag("textarea"));
171: assertSame(Tag.TH, HTML.getTag("th"));
172: assertSame(Tag.TITLE, HTML.getTag("title"));
173: assertSame(Tag.TR, HTML.getTag("tr"));
174: assertSame(Tag.TT, HTML.getTag("tt"));
175: assertSame(Tag.U, HTML.getTag("u"));
176: assertSame(Tag.UL, HTML.getTag("ul"));
177: assertSame(Tag.VAR, HTML.getTag("var"));
178:
179: if (isHarmony()) {
180: assertSame(Tag.ABBR, HTML.getTag("abbr"));
181: assertSame(Tag.ACRONYM, HTML.getTag("acronym"));
182: assertSame(Tag.BDO, HTML.getTag("bdo"));
183: assertSame(Tag.BUTTON, HTML.getTag("button"));
184: assertSame(Tag.COL, HTML.getTag("col"));
185: assertSame(Tag.COLGROUP, HTML.getTag("colgroup"));
186: assertSame(Tag.DEL, HTML.getTag("del"));
187: assertSame(Tag.FIELDSET, HTML.getTag("fieldset"));
188: assertSame(Tag.IFRAME, HTML.getTag("iframe"));
189: assertSame(Tag.INS, HTML.getTag("ins"));
190: assertSame(Tag.LABEL, HTML.getTag("label"));
191: assertSame(Tag.LEGEND, HTML.getTag("legend"));
192: assertSame(Tag.NOSCRIPT, HTML.getTag("noscript"));
193: assertSame(Tag.OPTGROUP, HTML.getTag("optgroup"));
194: assertSame(Tag.Q, HTML.getTag("q"));
195: assertSame(Tag.TBODY, HTML.getTag("tbody"));
196: assertSame(Tag.TFOOT, HTML.getTag("tfoot"));
197: assertSame(Tag.THEAD, HTML.getTag("thead"));
198:
199: } else {
200:
201: assertNull(HTML.getTag("abbr"));
202: assertNull(HTML.getTag("acronym"));
203: assertNull(HTML.getTag("bdo"));
204: assertNull(HTML.getTag("button"));
205: assertNull(HTML.getTag("col"));
206: assertNull(HTML.getTag("colgroup"));
207: assertNull(HTML.getTag("del"));
208: assertNull(HTML.getTag("fieldset"));
209: assertNull(HTML.getTag("iframe"));
210: assertNull(HTML.getTag("ins"));
211: assertNull(HTML.getTag("label"));
212: assertNull(HTML.getTag("legend"));
213: assertNull(HTML.getTag("noscript"));
214: assertNull(HTML.getTag("optgroup"));
215: assertNull(HTML.getTag("q"));
216: assertNull(HTML.getTag("tbody"));
217: assertNull(HTML.getTag("tfoot"));
218: assertNull(HTML.getTag("thead"));
219: }
220: }
221:
222: public void testGetAllAttributeKeys() {
223: final Attribute[] expected = { Attribute.ACTION,
224: Attribute.ALIGN, Attribute.ALINK, Attribute.ALT,
225: Attribute.ARCHIVE, Attribute.BACKGROUND,
226: Attribute.BGCOLOR, Attribute.BORDER,
227: Attribute.CELLPADDING, Attribute.CELLSPACING,
228: Attribute.CHECKED, Attribute.CLASS, Attribute.CLASSID,
229: Attribute.CLEAR, Attribute.CODE, Attribute.CODEBASE,
230: Attribute.CODETYPE, Attribute.COLOR, Attribute.COLS,
231: Attribute.COLSPAN, Attribute.COMMENT,
232: Attribute.COMPACT, Attribute.CONTENT, Attribute.COORDS,
233: Attribute.DATA, Attribute.DECLARE, Attribute.DIR,
234: Attribute.DUMMY, Attribute.ENCTYPE, Attribute.ENDTAG,
235: Attribute.FACE, Attribute.FRAMEBORDER,
236: Attribute.HALIGN, Attribute.HEIGHT, Attribute.HREF,
237: Attribute.HSPACE, Attribute.HTTPEQUIV, Attribute.ID,
238: Attribute.ISMAP, Attribute.LANG, Attribute.LANGUAGE,
239: Attribute.LINK, Attribute.LOWSRC,
240: Attribute.MARGINHEIGHT, Attribute.MARGINWIDTH,
241: Attribute.MAXLENGTH, Attribute.METHOD,
242: Attribute.MULTIPLE, Attribute.N, Attribute.NAME,
243: Attribute.NOHREF, Attribute.NORESIZE,
244: Attribute.NOSHADE, Attribute.NOWRAP, Attribute.PROMPT,
245: Attribute.REL, Attribute.REV, Attribute.ROWS,
246: Attribute.ROWSPAN, Attribute.SCROLLING,
247: Attribute.SELECTED, Attribute.SHAPE, Attribute.SHAPES,
248: Attribute.SIZE, Attribute.SRC, Attribute.STANDBY,
249: Attribute.START, Attribute.STYLE, Attribute.TARGET,
250: Attribute.TEXT, Attribute.TITLE, Attribute.TYPE,
251: Attribute.USEMAP, Attribute.VALIGN, Attribute.VALUE,
252: Attribute.VALUETYPE, Attribute.VERSION,
253: Attribute.VLINK, Attribute.VSPACE, Attribute.WIDTH, };
254:
255: Attribute[] actual = HTML.getAllAttributeKeys();
256: assertEquals(80, expected.length);
257: assertEquals(isHarmony() ? 84 : 81, actual.length);
258:
259: final boolean[] found = new boolean[expected.length];
260: for (int i = 0; i < expected.length; i++) {
261: for (int j = 0; j < actual.length; j++) {
262: if (expected[i] == actual[j]) {
263: found[i] = true;
264: break;
265: }
266: }
267: }
268:
269: for (int i = 0; i < found.length; i++) {
270: assertTrue("Attribute " + expected[i]
271: + " was not found, index " + i, found[i]);
272: }
273: }
274:
275: public void testGetAttributeKey() {
276: assertNull(HTML.getAttributeKey("httpequiv")); // without hyphen
277: assertNull(HTML.getAttributeKey("xmlns")); // XML namespace
278:
279: if (!isHarmony()) {
280: assertNotNull(HTML.getAttributeKey("media"));
281: }
282:
283: assertSame(Attribute.ACTION, HTML.getAttributeKey("action"));
284: assertSame(Attribute.ALIGN, HTML.getAttributeKey("align"));
285: assertSame(Attribute.ALINK, HTML.getAttributeKey("alink"));
286: assertSame(Attribute.ALT, HTML.getAttributeKey("alt"));
287: assertSame(Attribute.ARCHIVE, HTML.getAttributeKey("archive"));
288: assertSame(Attribute.BACKGROUND, HTML
289: .getAttributeKey("background"));
290: assertSame(Attribute.BGCOLOR, HTML.getAttributeKey("bgcolor"));
291: assertSame(Attribute.BORDER, HTML.getAttributeKey("border"));
292: assertSame(Attribute.CELLPADDING, HTML
293: .getAttributeKey("cellpadding"));
294: assertSame(Attribute.CELLSPACING, HTML
295: .getAttributeKey("cellspacing"));
296: assertSame(Attribute.CHECKED, HTML.getAttributeKey("checked"));
297: assertSame(Attribute.CLASS, HTML.getAttributeKey("class"));
298: assertSame(Attribute.CLASSID, HTML.getAttributeKey("classid"));
299: assertSame(Attribute.CLEAR, HTML.getAttributeKey("clear"));
300: assertSame(Attribute.CODE, HTML.getAttributeKey("code"));
301: assertSame(Attribute.CODEBASE, HTML.getAttributeKey("codebase"));
302: assertSame(Attribute.CODETYPE, HTML.getAttributeKey("codetype"));
303: assertSame(Attribute.COLOR, HTML.getAttributeKey("color"));
304: assertSame(Attribute.COLS, HTML.getAttributeKey("cols"));
305: assertSame(Attribute.COLSPAN, HTML.getAttributeKey("colspan"));
306: assertSame(Attribute.COMMENT, HTML.getAttributeKey("comment"));
307: assertSame(Attribute.COMPACT, HTML.getAttributeKey("compact"));
308: assertSame(Attribute.CONTENT, HTML.getAttributeKey("content"));
309: assertSame(Attribute.COORDS, HTML.getAttributeKey("coords"));
310: assertSame(Attribute.DATA, HTML.getAttributeKey("data"));
311: assertSame(Attribute.DECLARE, HTML.getAttributeKey("declare"));
312: assertSame(Attribute.DIR, HTML.getAttributeKey("dir"));
313: assertSame(Attribute.DUMMY, HTML.getAttributeKey("dummy"));
314: assertSame(Attribute.ENCTYPE, HTML.getAttributeKey("enctype"));
315: assertSame(Attribute.ENDTAG, HTML.getAttributeKey("endtag"));
316: assertSame(Attribute.FACE, HTML.getAttributeKey("face"));
317: assertSame(Attribute.FRAMEBORDER, HTML
318: .getAttributeKey("frameborder"));
319: assertSame(Attribute.HALIGN, HTML.getAttributeKey("halign"));
320: assertSame(Attribute.HEIGHT, HTML.getAttributeKey("height"));
321: assertSame(Attribute.HREF, HTML.getAttributeKey("href"));
322: assertSame(Attribute.HSPACE, HTML.getAttributeKey("hspace"));
323: assertSame(Attribute.HTTPEQUIV, HTML
324: .getAttributeKey("http-equiv"));
325: assertSame(Attribute.ID, HTML.getAttributeKey("id"));
326: assertSame(Attribute.ISMAP, HTML.getAttributeKey("ismap"));
327: assertSame(Attribute.LANG, HTML.getAttributeKey("lang"));
328: assertSame(Attribute.LANGUAGE, HTML.getAttributeKey("language"));
329: assertSame(Attribute.LINK, HTML.getAttributeKey("link"));
330: assertSame(Attribute.LOWSRC, HTML.getAttributeKey("lowsrc"));
331: assertSame(Attribute.MARGINHEIGHT, HTML
332: .getAttributeKey("marginheight"));
333: assertSame(Attribute.MARGINWIDTH, HTML
334: .getAttributeKey("marginwidth"));
335: assertSame(Attribute.MAXLENGTH, HTML
336: .getAttributeKey("maxlength"));
337: assertSame(Attribute.METHOD, HTML.getAttributeKey("method"));
338: assertSame(Attribute.MULTIPLE, HTML.getAttributeKey("multiple"));
339: assertSame(Attribute.N, HTML.getAttributeKey("n"));
340: assertSame(Attribute.NAME, HTML.getAttributeKey("name"));
341: assertSame(Attribute.NOHREF, HTML.getAttributeKey("nohref"));
342: assertSame(Attribute.NORESIZE, HTML.getAttributeKey("noresize"));
343: assertSame(Attribute.NOSHADE, HTML.getAttributeKey("noshade"));
344: assertSame(Attribute.NOWRAP, HTML.getAttributeKey("nowrap"));
345: assertSame(Attribute.PROMPT, HTML.getAttributeKey("prompt"));
346: assertSame(Attribute.REL, HTML.getAttributeKey("rel"));
347: assertSame(Attribute.REV, HTML.getAttributeKey("rev"));
348: assertSame(Attribute.ROWS, HTML.getAttributeKey("rows"));
349: assertSame(Attribute.ROWSPAN, HTML.getAttributeKey("rowspan"));
350: assertSame(Attribute.SCROLLING, HTML
351: .getAttributeKey("scrolling"));
352: assertSame(Attribute.SELECTED, HTML.getAttributeKey("selected"));
353: assertSame(Attribute.SHAPE, HTML.getAttributeKey("shape"));
354: assertSame(Attribute.SHAPES, HTML.getAttributeKey("shapes"));
355: assertSame(Attribute.SIZE, HTML.getAttributeKey("size"));
356: assertSame(Attribute.SRC, HTML.getAttributeKey("src"));
357: assertSame(Attribute.STANDBY, HTML.getAttributeKey("standby"));
358: assertSame(Attribute.START, HTML.getAttributeKey("start"));
359: assertSame(Attribute.STYLE, HTML.getAttributeKey("style"));
360: assertSame(Attribute.TARGET, HTML.getAttributeKey("target"));
361: assertSame(Attribute.TEXT, HTML.getAttributeKey("text"));
362: assertSame(Attribute.TITLE, HTML.getAttributeKey("title"));
363: assertSame(Attribute.TYPE, HTML.getAttributeKey("type"));
364: assertSame(Attribute.USEMAP, HTML.getAttributeKey("usemap"));
365: assertSame(Attribute.VALIGN, HTML.getAttributeKey("valign"));
366: assertSame(Attribute.VALUE, HTML.getAttributeKey("value"));
367: assertSame(Attribute.VALUETYPE, HTML
368: .getAttributeKey("valuetype"));
369: assertSame(Attribute.VERSION, HTML.getAttributeKey("version"));
370: assertSame(Attribute.VLINK, HTML.getAttributeKey("vlink"));
371: assertSame(Attribute.VSPACE, HTML.getAttributeKey("vspace"));
372: assertSame(Attribute.WIDTH, HTML.getAttributeKey("width"));
373: }
374:
375: public void testGetIntegerAttributeValue() {
376: MutableAttributeSet attrs = new SimpleAttributeSet();
377: attrs.addAttribute(Attribute.COLSPAN, new String("11"));
378: assertEquals(11, HTML.getIntegerAttributeValue(attrs,
379: Attribute.COLSPAN, -1));
380:
381: attrs = new SimpleAttributeSet();
382: attrs.addAttribute(Attribute.HREF, new String("10101"));
383: assertEquals(10101, HTML.getIntegerAttributeValue(attrs,
384: Attribute.HREF, -1));
385:
386: attrs = new SimpleAttributeSet();
387: attrs.addAttribute(Attribute.HREF, new String("not a number"));
388: assertEquals(-1, HTML.getIntegerAttributeValue(attrs,
389: Attribute.HREF, -1));
390:
391: attrs = new SimpleAttributeSet();
392: assertEquals(-1, HTML.getIntegerAttributeValue(attrs,
393: Attribute.HREF, -1));
394:
395: final MutableAttributeSet wrongValue = new SimpleAttributeSet();
396: wrongValue.addAttribute(Attribute.HREF, new Integer("10101"));
397: testExceptionalCase(new ClassCastCase() {
398: public void exceptionalAction() throws Exception {
399: HTML.getIntegerAttributeValue(wrongValue,
400: Attribute.HREF, -1);
401: }
402: });
403: }
404:
405: public void testStaticAttributeKeysOfAttributes() {
406: final Attribute[] attrs = HTML.getAllAttributeKeys();
407: for (int i = 0; i < attrs.length; i++) {
408: Object staticKey = StyleContext
409: .getStaticAttributeKey(attrs[i]);
410: assertSame("Static attribute for Attribute" + attrs[i]
411: + ", index " + i, attrs[i], StyleContext
412: .getStaticAttribute(staticKey));
413: }
414: }
415:
416: public void testStaticAttributeKeysOfTags() {
417: final Tag[] tags = HTML.getAllTags();
418: for (int i = 0; i < tags.length; i++) {
419: Object staticKey = StyleContext
420: .getStaticAttributeKey(tags[i]);
421: assertSame("Static attribute for Tag " + tags[i]
422: + ", index " + i, tags[i], StyleContext
423: .getStaticAttribute(staticKey));
424: }
425: }
426:
427: public void testResolveURL() throws Exception {
428: // Regression for HARMONY-4529
429: String base = "jar:file:test.jar!/root/current";
430: String relative = "dir/file";
431: String absolute = "http://host/file";
432: URL baseURL = new URL(base);
433: URL absoluteURL = new URL(absolute);
434: URL resolvedURL = new URL("jar:file:test.jar!/root/dir/file");
435:
436: assertEquals(resolvedURL, HTML.resolveURL(relative, base));
437: assertEquals(resolvedURL, HTML.resolveURL(relative, baseURL));
438:
439: assertEquals(absoluteURL, HTML.resolveURL(absolute, base));
440: assertEquals(absoluteURL, HTML.resolveURL(absolute, baseURL));
441: assertEquals(absoluteURL, HTML.resolveURL(absoluteURL, base));
442: assertEquals(absoluteURL, HTML.resolveURL(absoluteURL, baseURL));
443:
444: assertEquals(absoluteURL, HTML.resolveURL(absolute, (URL) null));
445: assertEquals(absoluteURL, HTML.resolveURL(absolute,
446: (String) null));
447: assertEquals(absoluteURL, HTML.resolveURL(absoluteURL,
448: (URL) null));
449: assertEquals(absoluteURL, HTML.resolveURL(absoluteURL,
450: (String) null));
451:
452: assertNull(HTML.resolveURL("", base));
453: assertNull(HTML.resolveURL("", baseURL));
454: assertNull(HTML.resolveURL((URL) null, base));
455: assertNull(HTML.resolveURL((URL) null, baseURL));
456: assertNull(HTML.resolveURL((String) null, base));
457: assertNull(HTML.resolveURL((String) null, baseURL));
458:
459: assertNull(HTML.resolveURL("", (URL) null));
460: assertNull(HTML.resolveURL("", (String) null));
461: assertNull(HTML.resolveURL((URL) null, (URL) null));
462: assertNull(HTML.resolveURL((URL) null, (String) null));
463: assertNull(HTML.resolveURL((String) null, (URL) null));
464: assertNull(HTML.resolveURL((String) null, (String) null));
465: }
466: }
|