View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.trinidad.component;
20  
21  import javax.faces.component.NamingContainer;
22  import javax.faces.component.UIComponent;
23  import javax.faces.component.UIForm;
24  import javax.faces.component.UIViewRoot;
25  
26  import javax.faces.context.FacesContext;
27  
28  import junit.framework.Test;
29  import junit.framework.TestSuite;
30  
31  import org.apache.myfaces.trinidadbuild.test.FacesTestCase;
32  
33  import org.apache.myfaces.trinidad.component.UIXPanel;
34  import org.apache.myfaces.trinidadbuild.test.FacesTestCase;
35  
36  public class FindComponentTest extends FacesTestCase
37  {
38    public static final Test suite()
39    {
40      return new TestSuite(FindComponentTest.class);
41    }
42    
43    public static void main(String[] args) throws Throwable
44    {
45      junit.textui.TestRunner.run(suite());
46    }
47  
48    public FindComponentTest(
49      String testName)
50    {
51      super(testName);
52    }
53  
54    static private class TestNamingContainer extends UIXPanel
55                                             implements NamingContainer
56    {
57      @Override
58      public UIComponent findComponent(String expr)
59      {
60        addToTrace(getId());
61        addToTrace(expr);
62        return super.findComponent(expr);
63      }
64  
65      public static void clearTrace()
66      {
67        _trace = new StringBuffer();
68      }
69  
70      // Append to the current trace log (or clear if null)
71      public static void addToTrace(String text)
72      {
73        _trace.append('/');
74        _trace.append(text);
75      }
76  
77      // Retrieve the current trace log
78      public static String getTrace()
79      {
80        return _trace.toString();
81      }
82  
83      // Accumulated trace log
84      private static StringBuffer _trace = new StringBuffer();
85    }
86  
87    
88    // Test nested NamingContainer callbacks
89    @SuppressWarnings("unchecked")
90    public void testNested()
91    {
92      TestNamingContainer a = new TestNamingContainer(); a.setId("a");
93      TestNamingContainer b = new TestNamingContainer(); b.setId("b");
94      TestNamingContainer d = new TestNamingContainer(); d.setId("d");
95      UIXPanel e = new UIXPanel(); e.setId("e");
96      UIXPanel g = new UIXPanel(); g.setId("g");
97      a.getChildren().add(b);
98      b.getChildren().add(d);
99      b.getChildren().add(g);
100     d.getChildren().add(e);
101     
102     TestNamingContainer.clearTrace();
103     assertTrue(a == a.findComponent("a"));
104     assertEquals("/a/a", TestNamingContainer.getTrace());
105     
106     TestNamingContainer.clearTrace();
107     assertTrue(a == a.findComponent(":a"));
108     assertEquals("/a/:a", TestNamingContainer.getTrace());
109     
110     TestNamingContainer.clearTrace();
111     assertTrue(b == a.findComponent("b"));
112     assertEquals("/a/b", TestNamingContainer.getTrace());
113     
114     TestNamingContainer.clearTrace();
115     assertTrue(b == a.findComponent(":b"));
116     assertEquals("/a/:b", TestNamingContainer.getTrace());
117     
118     TestNamingContainer.clearTrace();
119     assertTrue(d == a.findComponent("b:d"));
120     assertEquals("/a/b:d/b/d", TestNamingContainer.getTrace());
121     
122     TestNamingContainer.clearTrace();
123     assertTrue(d == a.findComponent(":b:d"));
124     assertEquals("/a/:b:d/b/d", TestNamingContainer.getTrace());
125     
126     TestNamingContainer.clearTrace();
127     assertTrue(e == a.findComponent("b:d:e"));
128     assertEquals("/a/b:d:e/b/d:e/d/e", TestNamingContainer.getTrace());
129     
130     TestNamingContainer.clearTrace();
131     assertTrue(e == a.findComponent(":b:d:e"));
132     assertEquals("/a/:b:d:e/b/d:e/d/e", TestNamingContainer.getTrace());
133     
134     TestNamingContainer.clearTrace();
135     assertTrue(g == a.findComponent("b:g"));
136     assertEquals("/a/b:g/b/g", TestNamingContainer.getTrace());
137     
138     TestNamingContainer.clearTrace();
139     assertTrue(g == a.findComponent(":b:g"));
140     assertEquals("/a/:b:g/b/g", TestNamingContainer.getTrace());
141   }
142 
143 
144   @SuppressWarnings("unchecked")
145   public void testRelativeSearch()
146   {
147     // Set up a component hierarchy as follows (component ids in quotes):
148     // "a" - UIViewRoot at head of hierarchy
149     // "a" has children "b" and "c"
150     // "b" has children "d" and "g"
151     // "d" has children "e" and "f"
152     // "c" has children "h" and "i"
153     // Components "b" and "d" implement NamingContainer
154     UIViewRoot a = new UIViewRoot(); a.setId("a");
155     UIForm b = new UIForm(); b.setId("b");
156     UIXPanel c = new UIXPanel(); c.setId("c");
157     TestNamingContainer d = new TestNamingContainer(); d.setId("d");
158     UIXPanel e = new UIXPanel(); e.setId("e");
159     UIXPanel f = new UIXPanel(); f.setId("f");
160     UIXPanel g = new UIXPanel(); g.setId("g");
161     UIXPanel h = new UIXPanel(); h.setId("h");
162     UIXPanel i = new UIXPanel(); i.setId("i");
163  
164     a.getChildren().add(b);
165     a.getChildren().add(c);
166     b.getChildren().add(d);
167     b.getChildren().add(g);
168     c.getChildren().add(h);
169     c.getChildren().add(i);
170     d.getChildren().add(e);
171     d.getChildren().add(f);
172     
173     // Positive relative searches from "a"
174     assertTrue(a == a.findComponent("a"));
175     assertTrue(b == a.findComponent("b"));
176     assertTrue(c == a.findComponent("c"));
177     assertTrue(d == a.findComponent("b:d"));
178     assertTrue(e == a.findComponent("b:d:e"));
179     assertTrue(f == a.findComponent("b:d:f"));
180     assertTrue(g == a.findComponent("b:g"));
181     assertTrue(h == a.findComponent("h"));
182     assertTrue(i == a.findComponent("i"));
183     
184     // Negative relative searches from "a"
185     assertNull(a.findComponent("d"));
186     assertNull(a.findComponent("e"));
187     assertNull(a.findComponent("f"));
188     assertNull(a.findComponent("g"));
189     
190     // Positive relative searches from "b"
191     assertTrue(b == b.findComponent("b"));
192     assertTrue(d == b.findComponent("d"));
193     assertTrue(e == b.findComponent("d:e"));
194     assertTrue(f == b.findComponent("d:f"));
195     assertTrue(g == b.findComponent("g"));
196     
197     // Negative relative searches from "b"
198     assertNull(b.findComponent("a"));
199     assertNull(b.findComponent("c"));
200     assertNull(b.findComponent("e"));
201     assertNull(b.findComponent("f"));
202     assertNull(b.findComponent("h"));
203     assertNull(b.findComponent("i"));
204     
205     // Positive relative searches from "c"
206     assertTrue(a == c.findComponent("a"));
207     assertTrue(b == c.findComponent("b"));
208     assertTrue(c == c.findComponent("c"));
209     assertTrue(d == c.findComponent("b:d"));
210     assertTrue(e == c.findComponent("b:d:e"));
211     assertTrue(f == c.findComponent("b:d:f"));
212     assertTrue(g == c.findComponent("b:g"));
213     assertTrue(h == c.findComponent("h"));
214     assertTrue(i == c.findComponent("i"));
215     
216     // Negative relative searches from "c"
217     assertNull(c.findComponent("d"));
218     assertNull(c.findComponent("e"));
219     assertNull(c.findComponent("f"));
220     assertNull(c.findComponent("g"));
221     
222     // Positive relative searches from "d"
223     assertTrue(d == d.findComponent("d"));
224     assertTrue(e == d.findComponent("e"));
225     assertTrue(f == d.findComponent("f"));
226     
227     // Negative relative searches from "d"
228     assertNull(d.findComponent("a"));
229     assertNull(d.findComponent("b"));
230     assertNull(d.findComponent("c"));
231     assertNull(d.findComponent("g"));
232     assertNull(d.findComponent("h"));
233     assertNull(d.findComponent("i"));
234     
235     // Positive relative searches from "e"
236     assertTrue(d == e.findComponent("d"));
237     assertTrue(e == e.findComponent("e"));
238     assertTrue(f == e.findComponent("f"));
239     
240     // Negative relative searches from "e"
241     assertNull(e.findComponent("a"));
242     assertNull(e.findComponent("b"));
243     assertNull(e.findComponent("c"));
244     assertNull(e.findComponent("g"));
245     assertNull(e.findComponent("h"));
246     assertNull(e.findComponent("i"));
247     
248     // Positive relative searches from "f"
249     assertTrue(d == f.findComponent("d"));
250     assertTrue(e == f.findComponent("e"));
251     assertTrue(f == f.findComponent("f"));
252     
253     // Negative relative searches from "f"
254     assertNull(f.findComponent("a"));
255     assertNull(f.findComponent("b"));
256     assertNull(f.findComponent("c"));
257     assertNull(f.findComponent("g"));
258     assertNull(f.findComponent("h"));
259     assertNull(f.findComponent("i"));
260     
261     // Positive relative searches from "g"
262     assertTrue(b == g.findComponent("b"));
263     assertTrue(d == g.findComponent("d"));
264     assertTrue(e == g.findComponent("d:e"));
265     assertTrue(f == g.findComponent("d:f"));
266     assertTrue(g == g.findComponent("g"));
267     
268     // Negative relative searches from "g"
269     assertNull(g.findComponent("a"));
270     assertNull(g.findComponent("c"));
271     assertNull(g.findComponent("e"));
272     assertNull(g.findComponent("f"));
273     assertNull(g.findComponent("h"));
274     assertNull(g.findComponent("i"));
275     
276     // Positive relative searches from "h"
277     assertTrue(a == h.findComponent("a"));
278     assertTrue(b == h.findComponent("b"));
279     assertTrue(c == h.findComponent("c"));
280     assertTrue(d == h.findComponent("b:d"));
281     assertTrue(e == h.findComponent("b:d:e"));
282     assertTrue(f == h.findComponent("b:d:f"));
283     assertTrue(g == h.findComponent("b:g"));
284     assertTrue(h == h.findComponent("h"));
285     assertTrue(i == h.findComponent("i"));
286     
287     // Negative relative searches from "h"
288     assertNull(h.findComponent("d"));
289     assertNull(h.findComponent("e"));
290     assertNull(h.findComponent("f"));
291     assertNull(h.findComponent("g"));
292     
293     // Positive relative searches from "i"
294     assertTrue(a == i.findComponent("a"));
295     assertTrue(b == i.findComponent("b"));
296     assertTrue(c == i.findComponent("c"));
297     assertTrue(d == i.findComponent("b:d"));
298     assertTrue(e == i.findComponent("b:d:e"));
299     assertTrue(f == i.findComponent("b:d:f"));
300     assertTrue(g == i.findComponent("b:g"));
301     assertTrue(h == i.findComponent("h"));
302     assertTrue(i == i.findComponent("i"));
303     
304     // Negative relative searches from "i"
305     assertNull(i.findComponent("d"));
306     assertNull(i.findComponent("e"));
307     assertNull(i.findComponent("f"));
308     assertNull(i.findComponent("g"));
309     
310     // Absolute searches from "a"
311     assertTrue(a == a.findComponent(":a"));
312     assertTrue(b == a.findComponent(":b"));
313     assertTrue(c == a.findComponent(":c"));
314     assertTrue(d == a.findComponent(":b:d"));
315     assertTrue(e == a.findComponent(":b:d:e"));
316     assertTrue(f == a.findComponent(":b:d:f"));
317     assertTrue(g == a.findComponent(":b:g"));
318     assertTrue(h == a.findComponent(":h"));
319     assertTrue(i == a.findComponent(":i"));
320     
321     // Absolute searches from "b"
322     assertTrue(a == b.findComponent(":a"));
323     assertTrue(b == b.findComponent(":b"));
324     assertTrue(c == b.findComponent(":c"));
325     assertTrue(d == b.findComponent(":b:d"));
326     assertTrue(e == b.findComponent(":b:d:e"));
327     assertTrue(f == b.findComponent(":b:d:f"));
328     assertTrue(g == b.findComponent(":b:g"));
329     assertTrue(h == b.findComponent(":h"));
330     assertTrue(i == b.findComponent(":i"));
331     
332     // Absolute searches from "c"
333     assertTrue(a == c.findComponent(":a"));
334     assertTrue(b == c.findComponent(":b"));
335     assertTrue(c == c.findComponent(":c"));
336     assertTrue(d == c.findComponent(":b:d"));
337     assertTrue(e == c.findComponent(":b:d:e"));
338     assertTrue(f == c.findComponent(":b:d:f"));
339     assertTrue(g == c.findComponent(":b:g"));
340     assertTrue(h == c.findComponent(":h"));
341     assertTrue(i == c.findComponent(":i"));
342     
343     // Absolute searches from "d"
344     assertTrue(a == d.findComponent(":a"));
345     assertTrue(b == d.findComponent(":b"));
346     assertTrue(c == d.findComponent(":c"));
347     assertTrue(d == d.findComponent(":b:d"));
348     assertTrue(e == d.findComponent(":b:d:e"));
349     assertTrue(f == d.findComponent(":b:d:f"));
350     assertTrue(g == d.findComponent(":b:g"));
351     assertTrue(h == d.findComponent(":h"));
352     assertTrue(i == d.findComponent(":i"));
353     
354     // Absolute searches from "e"
355     assertTrue(a == e.findComponent(":a"));
356     assertTrue(b == e.findComponent(":b"));
357     assertTrue(c == e.findComponent(":c"));
358     assertTrue(d == e.findComponent(":b:d"));
359     assertTrue(e == e.findComponent(":b:d:e"));
360     assertTrue(f == e.findComponent(":b:d:f"));
361     assertTrue(g == e.findComponent(":b:g"));
362     assertTrue(h == e.findComponent(":h"));
363     assertTrue(i == e.findComponent(":i"));
364     
365     // Absolute searches from "f"
366     assertTrue(a == f.findComponent(":a"));
367     assertTrue(b == f.findComponent(":b"));
368     assertTrue(c == f.findComponent(":c"));
369     assertTrue(d == f.findComponent(":b:d"));
370     assertTrue(e == f.findComponent(":b:d:e"));
371     assertTrue(f == f.findComponent(":b:d:f"));
372     assertTrue(g == f.findComponent(":b:g"));
373     assertTrue(h == f.findComponent(":h"));
374     assertTrue(i == f.findComponent(":i"));
375     
376     // Absolute searches from "g"
377     assertTrue(a == g.findComponent(":a"));
378     assertTrue(b == g.findComponent(":b"));
379     assertTrue(c == g.findComponent(":c"));
380     assertTrue(d == g.findComponent(":b:d"));
381     assertTrue(e == g.findComponent(":b:d:e"));
382     assertTrue(f == g.findComponent(":b:d:f"));
383     assertTrue(g == g.findComponent(":b:g"));
384     assertTrue(h == g.findComponent(":h"));
385     assertTrue(i == g.findComponent(":i"));
386     
387     // Absolute searches from "h"
388     assertTrue(a == h.findComponent(":a"));
389     assertTrue(b == h.findComponent(":b"));
390     assertTrue(c == h.findComponent(":c"));
391     assertTrue(d == h.findComponent(":b:d"));
392     assertTrue(e == h.findComponent(":b:d:e"));
393     assertTrue(f == h.findComponent(":b:d:f"));
394     assertTrue(g == h.findComponent(":b:g"));
395     assertTrue(h == h.findComponent(":h"));
396     assertTrue(i == h.findComponent(":i"));
397     
398     // Absolute searches from "i"
399     assertTrue(a == i.findComponent(":a"));
400     assertTrue(b == i.findComponent(":b"));
401     assertTrue(c == i.findComponent(":c"));
402     assertTrue(d == i.findComponent(":b:d"));
403     assertTrue(e == i.findComponent(":b:d:e"));
404     assertTrue(f == i.findComponent(":b:d:f"));
405     assertTrue(g == i.findComponent(":b:g"));
406     assertTrue(h == i.findComponent(":h"));
407     assertTrue(i == i.findComponent(":i"));
408   }
409 
410   @SuppressWarnings("unchecked")
411   public void testAbsoluteSearch()
412   {
413     // Set up a component hierarchy as follows (component ids in quotes):
414     // "a" - UIViewRoot at head of hierarchy
415     // "a" has children "b" and "c"
416     // "b" has children "d" and "g"
417     // "d" has children "e" and "f"
418     // "c" has children "h" and "i"
419     // Components "b" and "d" implement NamingContainer
420     UIViewRoot a = new UIViewRoot(); a.setId("a");
421     UIForm b = new UIForm(); b.setId("b");
422     UIXPanel c = new UIXPanel(); c.setId("c");
423     TestNamingContainer d = new TestNamingContainer(); d.setId("d");
424     UIXPanel e = new UIXPanel(); e.setId("e");
425     UIXPanel f = new UIXPanel(); f.setId("f");
426     UIXPanel g = new UIXPanel(); g.setId("g");
427     UIXPanel h = new UIXPanel(); h.setId("h");
428     UIXPanel i = new UIXPanel(); i.setId("i");
429     a.getChildren().add(b);
430     a.getChildren().add(c);
431     b.getChildren().add(d);
432     b.getChildren().add(g);
433     c.getChildren().add(h);
434     c.getChildren().add(i);
435     d.getChildren().add(e);
436     d.getChildren().add(f);
437         
438     // Absolute searches from "a"
439     assertTrue(a == a.findComponent(":a"));
440     assertTrue(b == a.findComponent(":b"));
441     assertTrue(c == a.findComponent(":c"));
442     assertTrue(d == a.findComponent(":b:d"));
443     assertTrue(e == a.findComponent(":b:d:e"));
444     assertTrue(f == a.findComponent(":b:d:f"));
445     assertTrue(g == a.findComponent(":b:g"));
446     assertTrue(h == a.findComponent(":h"));
447     assertTrue(i == a.findComponent(":i"));
448     
449     // Absolute searches from "b"
450     assertTrue(a == b.findComponent(":a"));
451     assertTrue(b == b.findComponent(":b"));
452     assertTrue(c == b.findComponent(":c"));
453     assertTrue(d == b.findComponent(":b:d"));
454     assertTrue(e == b.findComponent(":b:d:e"));
455     assertTrue(f == b.findComponent(":b:d:f"));
456     assertTrue(g == b.findComponent(":b:g"));
457     assertTrue(h == b.findComponent(":h"));
458     assertTrue(i == b.findComponent(":i"));
459     
460     // Absolute searches from "c"
461     assertTrue(a == c.findComponent(":a"));
462     assertTrue(b == c.findComponent(":b"));
463     assertTrue(c == c.findComponent(":c"));
464     assertTrue(d == c.findComponent(":b:d"));
465     assertTrue(e == c.findComponent(":b:d:e"));
466     assertTrue(f == c.findComponent(":b:d:f"));
467     assertTrue(g == c.findComponent(":b:g"));
468     assertTrue(h == c.findComponent(":h"));
469     assertTrue(i == c.findComponent(":i"));
470     
471     // Absolute searches from "d"
472     assertTrue(a == d.findComponent(":a"));
473     assertTrue(b == d.findComponent(":b"));
474     assertTrue(c == d.findComponent(":c"));
475     assertTrue(d == d.findComponent(":b:d"));
476     assertTrue(e == d.findComponent(":b:d:e"));
477     assertTrue(f == d.findComponent(":b:d:f"));
478     assertTrue(g == d.findComponent(":b:g"));
479     assertTrue(h == d.findComponent(":h"));
480     assertTrue(i == d.findComponent(":i"));
481     
482     // Absolute searches from "e"
483     assertTrue(a == e.findComponent(":a"));
484     assertTrue(b == e.findComponent(":b"));
485     assertTrue(c == e.findComponent(":c"));
486     assertTrue(d == e.findComponent(":b:d"));
487     assertTrue(e == e.findComponent(":b:d:e"));
488     assertTrue(f == e.findComponent(":b:d:f"));
489     assertTrue(g == e.findComponent(":b:g"));
490     assertTrue(h == e.findComponent(":h"));
491     assertTrue(i == e.findComponent(":i"));
492     
493     // Absolute searches from "f"
494     assertTrue(a == f.findComponent(":a"));
495     assertTrue(b == f.findComponent(":b"));
496     assertTrue(c == f.findComponent(":c"));
497     assertTrue(d == f.findComponent(":b:d"));
498     assertTrue(e == f.findComponent(":b:d:e"));
499     assertTrue(f == f.findComponent(":b:d:f"));
500     assertTrue(g == f.findComponent(":b:g"));
501     assertTrue(h == f.findComponent(":h"));
502     assertTrue(i == f.findComponent(":i"));
503     
504     // Absolute searches from "g"
505     assertTrue(a == g.findComponent(":a"));
506     assertTrue(b == g.findComponent(":b"));
507     assertTrue(c == g.findComponent(":c"));
508     assertTrue(d == g.findComponent(":b:d"));
509     assertTrue(e == g.findComponent(":b:d:e"));
510     assertTrue(f == g.findComponent(":b:d:f"));
511     assertTrue(g == g.findComponent(":b:g"));
512     assertTrue(h == g.findComponent(":h"));
513     assertTrue(i == g.findComponent(":i"));
514     
515     // Absolute searches from "h"
516     assertTrue(a == h.findComponent(":a"));
517     assertTrue(b == h.findComponent(":b"));
518     assertTrue(c == h.findComponent(":c"));
519     assertTrue(d == h.findComponent(":b:d"));
520     assertTrue(e == h.findComponent(":b:d:e"));
521     assertTrue(f == h.findComponent(":b:d:f"));
522     assertTrue(g == h.findComponent(":b:g"));
523     assertTrue(h == h.findComponent(":h"));
524     assertTrue(i == h.findComponent(":i"));
525     
526     // Absolute searches from "i"
527     assertTrue(a == i.findComponent(":a"));
528     assertTrue(b == i.findComponent(":b"));
529     assertTrue(c == i.findComponent(":c"));
530     assertTrue(d == i.findComponent(":b:d"));
531     assertTrue(e == i.findComponent(":b:d:e"));
532     assertTrue(f == i.findComponent(":b:d:f"));
533     assertTrue(g == i.findComponent(":b:g"));
534     assertTrue(h == i.findComponent(":h"));
535     assertTrue(i == i.findComponent(":i"));
536   }
537     
538   @SuppressWarnings("unchecked")
539   public void testExceptions()
540   {
541     // Set up a component hierarchy as follows (component ids in quotes):
542     // "a" - UIViewRoot at head of hierarchy
543     // "a" has children "b" and "c"
544     // "b" has children "d" and "g"
545     // "d" has children "e" and "f"
546     // "c" has children "h" and "i"
547     // Components "b" and "d" implement NamingContainer
548     UIViewRoot a = new UIViewRoot(); a.setId("a");
549     UIForm b = new UIForm(); b.setId("b");
550     UIXPanel c = new UIXPanel(); c.setId("c");
551     TestNamingContainer d = new TestNamingContainer(); d.setId("d");
552     UIXPanel e = new UIXPanel(); e.setId("e");
553     UIXPanel f = new UIXPanel(); f.setId("f");
554     UIXPanel g = new UIXPanel(); g.setId("g");
555     UIXPanel h = new UIXPanel(); h.setId("h");
556     UIXPanel i = new UIXPanel(); i.setId("i");
557     a.getChildren().add(b);
558     a.getChildren().add(c);
559     b.getChildren().add(d);
560     b.getChildren().add(g);
561     c.getChildren().add(h);
562     c.getChildren().add(i);
563     d.getChildren().add(e);
564     d.getChildren().add(f);
565 
566     // Cases that should throw exceptions
567     try
568     {
569       a.findComponent(null);
570       fail("Should have thrown NullPointerException");
571     }
572     catch (NullPointerException ex)
573     {
574       ; // Expected result
575     }
576     
577     try
578     {
579       a.findComponent("a:c:h");
580       fail("Should have thrown IllegalArgumentException");
581     }
582     catch (IllegalArgumentException ex)
583     {
584       ; // Expected result
585     }
586     
587     try
588     {
589       a.findComponent("a:c:i");
590       fail("Should have thrown IllegalArgumentException");
591     } catch (IllegalArgumentException ex)
592     {
593       ; // Expected result
594     }
595     
596     try
597     {
598       a.findComponent(":a:c:h");
599       fail("Should have thrown IllegalArgumentException");
600     }
601     catch (IllegalArgumentException ex)
602     {
603       ; // Expected result
604     }
605     
606     try
607     {
608       a.findComponent(":a:c:i");
609       fail("Should have thrown IllegalArgumentException");
610     }
611     catch (IllegalArgumentException ex)
612     {
613       ; // Expected result
614     }
615     
616     try
617     {
618       a.findComponent("c:h");
619       fail("Should have thrown IllegalArgumentException");
620     }
621     catch (IllegalArgumentException ex)
622     {
623       ; // Expected result
624     }
625     
626     try
627     {
628       a.findComponent("c:i");
629       fail("Should have thrown IllegalArgumentException");
630     }
631     catch (IllegalArgumentException ex)
632     {
633       ; // Expected result
634     }
635     
636     try
637     {
638       a.findComponent(":c:h");
639       fail("Should have thrown IllegalArgumentException");
640     }
641     catch (IllegalArgumentException ex)
642     {
643       ; // Expected result
644     }
645     
646     try
647     {
648       a.findComponent(":c:i");
649       fail("Should have thrown IllegalArgumentException");
650     }
651     catch (IllegalArgumentException ex)
652     {
653       ; // Expected result
654     }
655   }
656 }