KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > el > ValueBindingTest


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.myfaces.el;
17
18 import java.util.Map JavaDoc;
19
20 import javax.faces.el.ReferenceSyntaxException;
21 import javax.faces.el.ValueBinding;
22
23
24 /**
25  * @author Manfred Geiler (latest modification by $Author: matze $)
26  * @author Anton Koinov
27  * @version $Revision: 1.30 $ $Date: 2004/10/13 11:50:59 $
28  *
29  * $Log: ValueBindingTest.java,v $
30  * Revision 1.30 2004/10/13 11:50:59 matze
31  * renamed packages to org.apache
32  *
33  * Revision 1.29 2004/09/28 19:08:26 dave0000
34  * commented some non-working testcases
35  *
36  * Revision 1.28 2004/09/27 03:12:54 dave0000
37  * *** empty log message ***
38  *
39  * Revision 1.26 2004/09/08 07:43:52 mwessendorf
40  * added TestCase
41  *
42  * Revision 1.25 2004/09/06 16:21:10 mwessendorf
43  * added TestCase
44  *
45  * Revision 1.24 2004/09/02 08:40:18 mwessendorf
46  * added TestCase for bug #1018239
47  *
48  * Revision 1.23 2004/09/01 18:25:19 mwessendorf
49  * added TestCase
50  *
51  * Revision 1.22 2004/07/27 06:46:59 dave0000
52  * cleanup/arange testcases, remove duplicates
53  *
54  * Revision 1.21 2004/07/27 06:28:34 dave0000
55  * fix issue with getType of literal expressions (and other improvements)
56  *
57  * Revision 1.20 2004/07/01 22:00:55 mwessendorf
58  * ASF switch
59  *
60  * Revision 1.19 2004/05/11 04:24:12 dave0000
61  * Bug 943166: add value coercion to ManagedBeanConfigurator
62  *
63  * Revision 1.18 2004/05/10 05:30:15 dave0000
64  * Fix issue with setting Managed Bean to a wrong scope
65  *
66  * Revision 1.17 2004/04/07 03:54:07 dave0000
67  * fix testcases to match removed trim() on expression string
68  *
69  * Revision 1.16 2004/03/30 07:38:11 dave0000
70  * implement mixed string-reference expressions
71  */

72 public class ValueBindingTest extends ELBaseTest
73 {
74     //~ Constructors -------------------------------------------------------------------------------
75

76     public ValueBindingTest(String JavaDoc name)
77     {
78         super(name);
79     }
80
81     //~ Methods ------------------------------------------------------------------------------------
82

83     public void testGetValueWithLongName1() throws Exception JavaDoc
84     {
85         Object JavaDoc v;
86         ValueBinding vb = _application.createValueBinding("#{theA}");
87         v = vb.getValue(_facesContext);
88         assertTrue(v == _theA);
89     }
90
91     public void testGetValueWithLongName2() throws Exception JavaDoc
92     {
93         Object JavaDoc v;
94         v = _application.createValueBinding("#{theA.name}").getValue(
95             _facesContext);
96         assertEquals(A.NAME, v);
97     }
98
99     public void testGetValueWithLongName3() throws Exception JavaDoc
100     {
101         Object JavaDoc v;
102         v = _application.createValueBinding("#{theA.theB.name}").getValue(
103             _facesContext);
104         assertEquals(B.NAME, v);
105     }
106
107     public void testGetValueWithLongName4() throws Exception JavaDoc
108     {
109         Object JavaDoc v;
110         v = _application.createValueBinding("#{theA.theB.theC.name}").getValue(
111             _facesContext);
112         assertEquals(C.DEFAULT_NAME, v);
113     }
114
115     public void testGetValueWithShortName1() throws Exception JavaDoc
116     {
117         Object JavaDoc v;
118         v = _application.createValueBinding("#{a}").getValue(_facesContext);
119         assertTrue(v == _a);
120     }
121
122     public void testGetValueWithShortName2() throws Exception JavaDoc
123     {
124         Object JavaDoc v;
125         v = _application.createValueBinding("#{a.name}")
126             .getValue(_facesContext);
127         assertEquals(A.NAME, v);
128     }
129
130     public void testGetValueWithShortName3() throws Exception JavaDoc
131     {
132         Object JavaDoc v;
133         v = _application.createValueBinding("#{a.b.name}").getValue(
134             _facesContext);
135         assertEquals(B.NAME, v);
136     }
137
138     public void testGetValueWithShortName4() throws Exception JavaDoc
139     {
140         Object JavaDoc v;
141         v = _application.createValueBinding("#{a.b.c.name}").getValue(
142             _facesContext);
143         assertEquals(C.DEFAULT_NAME, v);
144     }
145
146     public void testGetValue() throws Exception JavaDoc
147     {
148         ValueBinding vb;
149         Object JavaDoc r;
150
151         vb = _application.createValueBinding("#{testmap}");
152         r = vb.getValue(_facesContext);
153         assertEquals(_m, r);
154
155         vb = _application.createValueBinding("#{true ? testmap : testmap.f}");
156         r = vb.getValue(_facesContext);
157         assertEquals(_m, r);
158
159         vb = _application.createValueBinding("#{testmap.f}");
160         r = vb.getValue(_facesContext);
161         assertFalse(((Boolean JavaDoc) r).booleanValue());
162
163         vb = _application.createValueBinding("#{false ? testmap : testmap.f}");
164         r = vb.getValue(_facesContext);
165         assertFalse(((Boolean JavaDoc) r).booleanValue());
166
167         vb = _application.createValueBinding("#{testmap.t}");
168         r = vb.getValue(_facesContext);
169         assertTrue(((Boolean JavaDoc) r).booleanValue());
170
171         vb = _application.createValueBinding("#{testmap[\"o\"]['obj']}");
172         r = vb.getValue(_facesContext);
173         assertEquals("OBJECT", r);
174
175         vb = _application
176             .createValueBinding("#{ testmap [ \"o\" ] [ 'obj' ] }");
177         r = vb.getValue(_facesContext);
178         assertEquals("OBJECT", r);
179
180         vb = _application.createValueBinding("#{testmap.true_}");
181         r = vb.getValue(_facesContext);
182         assertEquals("TRUE_", r);
183
184         vb = _application.createValueBinding("#{ testmap . true_ }");
185         r = vb.getValue(_facesContext);
186         assertEquals("TRUE_", r);
187
188         vb = _application.createValueBinding("#{testmap[\"true_\"]}");
189         r = vb.getValue(_facesContext);
190         assertEquals("TRUE_", r);
191
192         vb = _application.createValueBinding("#{testmap['true_']}");
193         r = vb.getValue(_facesContext);
194         assertEquals("TRUE_", r);
195
196         vb = _application.createValueBinding("#{testmap[testmap.t]}");
197         r = vb.getValue(_facesContext);
198         assertEquals("TRUE", r);
199
200         vb = _application
201             .createValueBinding("#{ testmap [ testmap . t ] }");
202         r = vb.getValue(_facesContext);
203         assertEquals("TRUE", r);
204
205         vb = _application.createValueBinding("#{testmap.false_}");
206         r = vb.getValue(_facesContext);
207         assertEquals("FALSE_", r);
208
209         vb = _application.createValueBinding("#{testmap[testmap.f]}");
210         r = vb.getValue(_facesContext);
211         assertEquals("FALSE", r);
212
213         vb = _application.createValueBinding("#{testmap['map']}");
214         r = vb.getValue(_facesContext);
215         assertEquals(_m, r);
216
217         vb = _application.createValueBinding("#{testmap[\"David's\"]}");
218         r = vb.getValue(_facesContext);
219         assertEquals(_m, r);
220
221         vb = _application.createValueBinding("#{testmap['David\\'s']}");
222         r = vb.getValue(_facesContext);
223         assertEquals(_m, r);
224
225         vb = _application.createValueBinding("#{testmap['my]bracket[']}");
226         r = vb.getValue(_facesContext);
227         assertEquals(_m, r);
228
229         vb = _application.createValueBinding("#{testmap[\"my]bracket[\"]}");
230         r = vb.getValue(_facesContext);
231         assertEquals(_m, r);
232
233         vb = _application.createValueBinding("#{testmap[\"my\\\\]bracket[\"]}");
234         r = vb.getValue(_facesContext);
235         assertEquals(_m, r);
236
237         vb = _application.createValueBinding("#{testmap[0][0]}");
238         r = vb.getValue(_facesContext);
239         assertEquals(new Integer JavaDoc(0), r);
240
241         vb = _application.createValueBinding("#{ testmap [ 0 ] [ 0 ]}");
242         r = vb.getValue(_facesContext);
243         assertEquals(new Integer JavaDoc(0), r);
244
245         vb = _application.createValueBinding("#{testmap.o0.obj[0]}");
246         r = vb.getValue(_facesContext);
247         assertEquals(new Integer JavaDoc(0), r);
248
249         vb = _application.createValueBinding("#{testmap.o1.obj[0][0]}");
250         r = vb.getValue(_facesContext);
251         assertEquals(new Integer JavaDoc(0), r);
252
253         vb = _application.createValueBinding("#{testmap.list[0][0]}");
254         r = vb.getValue(_facesContext);
255         assertEquals(new Integer JavaDoc(0), r);
256
257         vb = _application.createValueBinding("#{testmap.list[1][0]}");
258         r = vb.getValue(_facesContext);
259         assertEquals(_a0, r);
260
261         vb = _application.createValueBinding("#{testmap.list[4][0][0]}");
262         r = vb.getValue(_facesContext);
263         assertEquals(new Integer JavaDoc(0), r);
264
265         vb = _application.createValueBinding("#{testmap.list[4][1][0][0]}");
266         r = vb.getValue(_facesContext);
267         assertEquals(new Integer JavaDoc(0), r);
268
269         vb = _application
270             .createValueBinding("#{testmap.list[4].list[1][0][0]}");
271         r = vb.getValue(_facesContext);
272         assertEquals(new Integer JavaDoc(0), r);
273
274         vb = _application
275             .createValueBinding("#{testmap.map.map.list[4].list[4][1][0][0]}");
276         r = vb.getValue(_facesContext);
277         assertEquals(new Integer JavaDoc(0), r);
278
279         vb = _application
280             .createValueBinding("#{testmap.map.list[4].map.list[4][1][0][0]}");
281         r = vb.getValue(_facesContext);
282         assertEquals(new Integer JavaDoc(0), r);
283
284         vb = _application
285             .createValueBinding("#{testmap.list[4][testmap.list[4][0][0]][0]}");
286         r = vb.getValue(_facesContext);
287         assertEquals(new Integer JavaDoc(0), r);
288
289         vb = _application
290             .createValueBinding("#{testmap.list[4][1][0][testmap.list[4][0][0]]}");
291         r = vb.getValue(_facesContext);
292         assertEquals(new Integer JavaDoc(0), r);
293
294         vb = _application
295             .createValueBinding("#{testmap.list[4].list[testmap.list[4][1][0][testmap.list[4][0][1]]][0][0]}");
296         r = vb.getValue(_facesContext);
297         assertEquals(new Integer JavaDoc(0), r);
298
299         vb = _application
300             .createValueBinding("#{testmap.map.map.list[4].list[4][1][testmap.list[4].list[testmap.list[4][1][0][testmap.list[4][0][testmap.t]]][0][0]][0]}");
301         r = vb.getValue(_facesContext);
302         assertEquals(new Integer JavaDoc(0), r);
303
304         vb = _application
305             .createValueBinding("#{testmap['my]bracket[']['map'].list[4]['map'][\"list\"][4][1][testmap.map.map.list[4].list[4][1][testmap.list[4].list[testmap.list[4][1][testmap.f][testmap['list'][4][0][1]]][0][0]][0]][0]}");
306         r = vb.getValue(_facesContext);
307         assertEquals(new Integer JavaDoc(0), r);
308
309         vb = _application
310             .createValueBinding("#{testmap['my]bracket[']['map'].list[4]['map'][\"list\"][4][1][testmap.map.map.list[4].list[4][1][testmap.list[4].list[testmap.list[4][1][testmap.f][testmap['list'][4][0][1]]][0][0]][0]][0]}");
311         r = vb.getValue(_facesContext);
312         assertEquals(new Integer JavaDoc(0), r);
313
314         vb = _application
315             .createValueBinding("#{testmap['my\\\\]bracket[']['map'].list[4]['map'][\"list\"][4][1][testmap.map.map.list[4].list[4][1][testmap.list[4].list[testmap.list[4][1][testmap.f][testmap['list'][4][0][1]]][0][0]][0]][0]}");
316         r = vb.getValue(_facesContext);
317         assertEquals(new Integer JavaDoc(0), r);
318
319         vb = _application.createValueBinding("#{testmap[\"\\\\]true[\"]}");
320         r = vb.getValue(_facesContext);
321         assertEquals("_TRUE_", r);
322
323         vb = _application.createValueBinding("#{testmap['\\\\]false[']}");
324         r = vb.getValue(_facesContext);
325         assertEquals("_FALSE_", r);
326
327         // Now check for error conditions
328
try
329         {
330             vb = _application
331                 .createValueBinding("#{testmap['my\\\\]bracket[']['map'].list[4]['map'][\"list\"][4][1][testmap.map.map.list[4].list[4][1][testmap.list[4].list[testmap.list[4][1][testmap.f][testmap['list'][4][0][1]]][0][0]][0][0]}");
332             assertTrue(false);
333         }
334         catch (ReferenceSyntaxException e)
335         {
336             //System.out.println(e.getMessage());
337
// we expect this
338
}
339
340         try
341         {
342             vb = _application
343                 .createValueBinding("#{testmap.map.list[4].map.list[][1][0][0]}");
344             assertTrue(false);
345         }
346         catch (ReferenceSyntaxException e)
347         {
348             //System.out.println(e.getMessage());
349
// we expect this
350
}
351
352         try
353         {
354             vb = _application
355                 .createValueBinding("#{testmap.map.list[4].map.list.[4][1][0][0]}");
356             assertTrue(false);
357         }
358         catch (ReferenceSyntaxException e)
359         {
360             //System.out.println(e.getMessage());
361
// we expect this
362
}
363
364         try
365         {
366             vb = _application
367                 .createValueBinding("#{testmap.map.list[4].map..list[4][1][0][0]}");
368             assertTrue(false);
369         }
370         catch (ReferenceSyntaxException e)
371         {
372             //System.out.println(e.getMessage());
373
// we expect this
374
}
375
376         try
377         {
378             vb = _application
379                 .createValueBinding("#{.testmap.map.list[4].map.list[4][1][0][0]}");
380             assertTrue(false);
381         }
382         catch (ReferenceSyntaxException e)
383         {
384             //System.out.println(e.getMessage());
385
// we expect this
386
}
387
388         try
389         {
390             vb = _application
391                 .createValueBinding("#{testmap.map.list[4].map.list[4[1][0]['0']}");
392             assertTrue(false);
393         }
394         catch (ReferenceSyntaxException e)
395         {
396             //System.out.println(e.getMessage());
397
// we expect this
398
}
399
400         try
401         {
402             vb = _application
403                 .createValueBinding("#{testmap.map.list[4].map.list[4][1][0].[0]}");
404             assertTrue(false);
405         }
406         catch (ReferenceSyntaxException e)
407         {
408             //System.out.println(e.getMessage());
409
// we expect this
410
}
411     }
412
413     public void testMixedExpressions()
414     {
415         ValueBinding vb;
416         Object JavaDoc r;
417
418         vb = _application
419             .createValueBinding("This is one #{testmap[\"o\"]['obj']}");
420         r = vb.getValue(_facesContext);
421         assertEquals("This is one OBJECT", r);
422
423         vb = _application
424             .createValueBinding("#{ testmap [ \"o\" ] [ 'obj' ] } is the One.");
425         r = vb.getValue(_facesContext);
426         assertEquals("OBJECT is the One.", r);
427
428         vb = _application.createValueBinding("Is it really #{testmap.true_}?");
429         r = vb.getValue(_facesContext);
430         assertEquals("Is it really TRUE_?", r);
431
432         vb = _application
433             .createValueBinding("#{testmap . true_} or #{testmap.false_}, that's the question!");
434         r = vb.getValue(_facesContext);
435         assertEquals("TRUE_ or FALSE_, that's the question!", r);
436
437         vb = _application
438             .createValueBinding("What? #{testmap . true_} or #{testmap.false_}, that's the question!");
439         r = vb.getValue(_facesContext);
440         assertEquals("What? TRUE_ or FALSE_, that's the question!", r);
441
442         vb = _application
443             .createValueBinding("What? ${ #{testmap . true_} or #{testmap.false_}, that's the question! }");
444         r = vb.getValue(_facesContext);
445         assertEquals("What? ${ TRUE_ or FALSE_, that's the question! }", r);
446
447         vb = _application
448             .createValueBinding("#{ '#{' } What? ${ #{true ? '${' : \"#{\\\\\"} #{testmap . true_} or #{testmap.false_}, that's the question! }");
449         r = vb.getValue(_facesContext);
450         assertEquals("#{ What? ${ ${ TRUE_ or FALSE_, that's the question! }",
451             r);
452
453 // // Test '\' as escape for #{
454
// vb = _application.createValueBinding("\\#{ \\\\\\#{ What? ${ \\\\#{false ? '${' : \"#{\\\\\"} #{testmap . true_} or #{testmap.false_}, that's the question! }");
455
// r = vb.getValue(_facesContext);
456
// assertEquals("#{ \\#{ What? ${ \\\\#{\\ TRUE_ or FALSE_, that's the question! }", r);
457
}
458
459     public void testIsReadOnly() throws Exception JavaDoc
460     {
461         ValueBinding vb;
462
463         vb = _application.createValueBinding("#{'constant literal'}");
464         assertTrue(vb.isReadOnly(_facesContext));
465
466         vb = _application.createValueBinding("#{cookie}");
467         assertTrue(vb.isReadOnly(_facesContext));
468
469         vb = _application.createValueBinding("#{requestScope}");
470         assertTrue(vb.isReadOnly(_facesContext));
471
472         vb = _application.createValueBinding("#{a.name}");
473         assertTrue(vb.isReadOnly(_facesContext));
474
475         vb = _application.createValueBinding("#{theA.theB.name}");
476         assertFalse(vb.isReadOnly(_facesContext));
477
478         vb = _application.createValueBinding("#{testmap}");
479         assertFalse(vb.isReadOnly(_facesContext));
480
481         vb = _application.createValueBinding("#{testmap.f}");
482         assertFalse(vb.isReadOnly(_facesContext));
483
484         vb = _application.createValueBinding("#{ testmap [ 0 ] [ 0 ]}");
485         assertFalse(vb.isReadOnly(_facesContext));
486
487         vb = _application.createValueBinding("#{true ? cookie : max}");
488         assertTrue(vb.isReadOnly(_facesContext));
489
490         vb = _application.createValueBinding("#{false ? cookie : max}");
491         assertFalse(vb.isReadOnly(_facesContext));
492
493         //-----------------------------------------------------
494
// Read-only of nonexistent object (e.g., one whose base is null)
495

496         vb = _application.createValueBinding("#{nonExistentValueBlahBlahBlah}");
497         assertFalse(vb.isReadOnly(_facesContext));
498
499         vb = _application
500             .createValueBinding("#{nonExistingValueBlahBlahBlah.blah}");
501         assertFalse(vb.isReadOnly(_facesContext));
502
503         vb = _application
504             .createValueBinding("#{nonExistingValueBlahBlahBlah.blah.blah}");
505         assertFalse(vb.isReadOnly(_facesContext));
506     }
507
508     public void testGetType() throws Exception JavaDoc
509     {
510         ValueBinding vb;
511
512         //-----------------------------------------------------
513
// Literal expression
514

515         vb = _application.createValueBinding("#{'constant literal'}");
516         assertSame(String JavaDoc.class, vb.getType(_facesContext));
517
518         vb = _application.createValueBinding("#{false && true}");
519         assertSame(Boolean JavaDoc.class, vb.getType(_facesContext));
520
521         vb = _application
522             .createValueBinding("#{applicationScope.bean == null}");
523         assertSame(Boolean JavaDoc.class, vb.getType(_facesContext));
524
525         // REVISIT: Should getType of implicit object throw an error,
526
// return null, or Object.class, or the appropriate Map class?
527
vb = _application.createValueBinding("#{cookie}");
528         assertTrue(Map JavaDoc.class.isAssignableFrom(vb.getType(_facesContext)));
529
530         vb = _application.createValueBinding("#{requestScope}");
531         assertTrue(Map JavaDoc.class.isAssignableFrom(vb.getType(_facesContext)));
532
533         vb = _application.createValueBinding("#{true ? cookie : max}");
534         assertTrue(Map JavaDoc.class.isAssignableFrom(vb.getType(_facesContext)));
535
536         // REVISIT: should unknown bean name return type null or Object.class?
537
vb = _application.createValueBinding("#{false ? cookie : max}");
538         assertSame(Object JavaDoc.class, vb.getType(_facesContext));
539
540         //-----------------------------------------------------
541
// Specific types
542

543         vb = _application.createValueBinding("#{a.name}");
544         assertSame(A.NAME.getClass(), vb.getType(_facesContext));
545
546         vb = _application.createValueBinding("#{theA.theB.name}");
547         assertSame(B.NAME.getClass(), vb.getType(_facesContext));
548
549         vb = _application.createValueBinding("#{testmap}");
550         assertSame(_m.getClass(), vb.getType(_facesContext));
551
552         vb = _application.createValueBinding("#{testmap.f}");
553         assertSame(Boolean JavaDoc.class, vb.getType(_facesContext));
554
555         vb = _application.createValueBinding("#{ testmap [ 0 ] [ 1 ]}");
556         // Object.class is the _a0 Array Component Type!
557
assertSame(Object JavaDoc.class, vb.getType(_facesContext));
558
559         //-----------------------------------------------------
560
// Type of nonexistent object (e.g., one whose base is null)
561

562         vb = _application.createValueBinding("#{nonExistentValueBlahBlahBlah}");
563         assertSame(Object JavaDoc.class, vb.getType(_facesContext));
564
565         vb = _application
566             .createValueBinding("#{nonExistingValueBlahBlahBlah.blah}");
567         assertSame(null, vb.getType(_facesContext));
568
569         vb = _application
570             .createValueBinding("#{nonExistingValueBlahBlahBlah.blah.blah}");
571         assertSame(null, vb.getType(_facesContext));
572     }
573
574     public void testManagedBean() throws Exception JavaDoc
575     {
576         ValueBinding vb;
577
578         vb = _application.createValueBinding("#{testBean_B.name}");
579         assertEquals("testName", vb.getValue(_facesContext));
580
581         vb = _application.createValueBinding("#{testBean_B.int}");
582         assertEquals(new Integer JavaDoc(1), vb.getValue(_facesContext));
583
584         vb = _application.createValueBinding("#{testBean_B.double}");
585         assertEquals(new Double JavaDoc(1.1), vb.getValue(_facesContext));
586
587         vb = _application.createValueBinding("#{testBean_B.integer}");
588         assertEquals(new Integer JavaDoc(2), vb.getValue(_facesContext));
589
590         vb = _application.createValueBinding("#{testBean_B.double2}");
591         assertEquals(new Double JavaDoc(2.2), vb.getValue(_facesContext));
592
593         vb = _application.createValueBinding("#{testBean_B1.double2}");
594         assertEquals(new Double JavaDoc(2.2), vb.getValue(_facesContext));
595
596         vb = _application.createValueBinding("#{testBean_B2.name}");
597         assertEquals(B.NAME, vb.getValue(_facesContext));
598
599         vb = _application.createValueBinding("#{testBean_B2.int}");
600         assertEquals(new Integer JavaDoc(-1), vb.getValue(_facesContext));
601
602         vb = _application.createValueBinding("#{testBean_B2.double}");
603         assertEquals(new Double JavaDoc(-1.1), vb.getValue(_facesContext));
604
605         vb = _application.createValueBinding("#{testBean_B2.integer}");
606         assertEquals(new Integer JavaDoc(-2), vb.getValue(_facesContext));
607
608         vb = _application.createValueBinding("#{testBean_B2.double2}");
609         assertEquals(new Double JavaDoc(-2.2), vb.getValue(_facesContext));
610
611         vb = _application.createValueBinding("#{testBean_E.a}");
612         assertEquals("foo", vb.getValue(_facesContext));
613
614         vb = _application.createValueBinding("#{testBean_E.b}");
615         assertEquals("bar", vb.getValue(_facesContext));
616
617         vb = _application.createValueBinding("#{testBean_E.a}#{testBean_E.b}");
618         assertEquals("foobar", vb.getValue(_facesContext));
619
620         vb = _application.createValueBinding("#{testBean_E.c['foo']}");
621         assertEquals("bar", vb.getValue(_facesContext));
622
623         vb = _application.createValueBinding("#{!empty testBean_E.d}");
624         assertFalse("false", Boolean.getBoolean(vb.getValue(_facesContext)
625             .toString()));
626
627     }
628
629     public void testEL() throws Exception JavaDoc
630     {
631         ValueBinding vb;
632
633         vb = _application
634             .createValueBinding("#{facesContext.application.defaultRenderKitId}");
635         assertEquals("HTML_BASIC", vb.getValue(_facesContext));
636
637
638         //vb = _application.createValueBinding("#{facesContext.viewRoot.renderKitId}");
639
//assertEquals("HTML_BASIC", vb.getValue(_facesContext));
640

641         //vb = _application.createValueBinding("#{facesContext.viewRoot.viewId}");
642
//assertNotNull(vb.getValue(_facesContext));
643
}
644 }
Popular Tags