1 /**
2 * Copyright 2005-2014 The Kuali Foundation
3 *
4 * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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.kuali.rice.krad.uif.field;
17
18 import static junit.framework.Assert.assertEquals;
19
20 import org.junit.Test;
21
22 import java.util.ArrayList;
23 import java.util.List;
24
25 public class DataFieldTest {
26 @Test
27 /**
28 * Tests setting and retrieving default value
29 */
30 public void testSetDefaultValueSucceeds() {
31
32 // create mock objects for view, model, and component
33 String defaultValue = "default";
34
35 DataField dataField = new DataFieldBase();
36 dataField.setDefaultValue(defaultValue);
37 assertEquals(defaultValue, dataField.getDefaultValue());
38 }
39
40 @Test
41 /**
42 * Tests setting and retrieving default values
43 */
44 public void testSetDefaultValuesSucceeds() {
45 // create mock objects for view, model, and component
46 List<Object> defaultValues = new ArrayList<Object>();
47 defaultValues.add("A");
48 defaultValues.add("B");
49
50 DataField dataField = new DataFieldBase();
51 dataField.setDefaultValues(defaultValues);
52 assertEquals(defaultValues, dataField.getDefaultValues());
53 }
54 }