1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.util;
17
18 import org.junit.Before;
19 import org.junit.Test;
20 import org.kuali.rice.krad.uif.component.Component;
21 import org.kuali.rice.krad.uif.field.InputField;
22
23 import static junit.framework.Assert.assertEquals;
24 import static junit.framework.Assert.assertTrue;
25
26
27
28
29
30
31 public class ComponentUtilsTest {
32
33 private String componentId;
34 private Component component;
35
36 @Before
37 public void setup() {
38 component = new InputField();
39 componentId = "field1";
40 component.setId(componentId);
41 component.setBaseId(componentId);
42 }
43
44 @Test
45
46
47
48 public void testUpdateIdWithSuffix() {
49 ComponentUtils.updateIdWithSuffix(component, null);
50 assertTrue(component.getId().equalsIgnoreCase(componentId));
51
52 String suffix = "_field";
53 ComponentUtils.updateIdWithSuffix(component, suffix);
54 assertTrue(component.getId().equalsIgnoreCase(componentId + suffix));
55
56 }
57 }