1 /**
2 * Copyright 2005-2013 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 org.junit.Test;
19 import org.kuali.rice.krad.uif.component.Component;
20 import org.kuali.rice.krad.uif.element.Label;
21 import org.kuali.rice.krad.uif.element.Message;
22 import org.kuali.rice.krad.uif.view.View;
23
24 import static junit.framework.Assert.*;
25 import static org.mockito.Mockito.*;
26
27 public class DataFieldTest {
28 @Test
29 /**
30 * Tests setting and retrieving default value
31 */
32 public void testSetDefaultValueSucceeds() {
33
34 // create mock objects for view, model, and component
35 String defaultValue = "default";
36
37 DataField dataField = new DataField();
38 dataField.setDefaultValue(defaultValue);
39 assertEquals(defaultValue, dataField.getDefaultValue());
40 }
41
42 @Test
43 /**
44 * Tests setting and retrieving default values
45 */
46 public void testSetDefaultValuesSucceeds() {
47
48 // create mock objects for view, model, and component
49 Object[] defaultValues = new Object[2];
50 defaultValues[0] = new String("A");
51 defaultValues[1] = new String("B");
52
53 DataField dataField = new DataField();
54 dataField.setDefaultValues(defaultValues);
55 assertEquals(defaultValues, dataField.getDefaultValues());
56 }
57 }