KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > junit > TestMultipart


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

15 package org.apache.tapestry.junit;
16
17 import org.apache.tapestry.multipart.ValuePart;
18
19 /**
20  * A few tests to fill in the code coverage of {@link org.apache.tapestry.multipart.ValuePart}and
21  * {@link org.apache.tapestry.multipart.UploadPart}.
22  *
23  * @author Howard Lewis Ship
24  * @since 3.0
25  */

26 public class TestMultipart extends TapestryTestCase
27 {
28
29     public void testSingle()
30     {
31         ValuePart p = new ValuePart("first");
32
33         assertEquals(1, p.getCount());
34         assertEquals("first", p.getValue());
35
36         checkList("values", new String JavaDoc[]
37         { "first" }, p.getValues());
38     }
39
40     public void testTwo()
41     {
42         ValuePart p = new ValuePart("alpha");
43
44         p.add("beta");
45
46         assertEquals(2, p.getCount());
47         assertEquals("alpha", p.getValue());
48         checkList("values", new String JavaDoc[]
49         { "alpha", "beta" }, p.getValues());
50     }
51
52     public void testThree()
53     {
54         ValuePart p = new ValuePart("moe");
55         p.add("larry");
56         p.add("curly");
57
58         checkList("values", new String JavaDoc[]
59         { "moe", "larry", "curly" }, p.getValues());
60     }
61 }
62
Popular Tags