/**
 * Copyright 2005-2013 The Kuali Foundation
 *
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.opensource.org/licenses/ecl2.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.rice.krad.uif.field;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import org.junit.Test;
import org.kuali.rice.krad.uif.component.Component;
import org.kuali.rice.krad.uif.element.Label;
import org.kuali.rice.krad.uif.element.Message;

/**
 * test various FieldBase methods
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
public class FieldBaseTest {

    @Test
    /**
     * Tests rendering on required messages
     *
     * @see KULRICE-7130
     */
    public void testRequiredMessageDisplay() throws Exception {

        // create mock component
//        View mockView =  mock(View.class);
//        ViewHelperService mockViewHelperService = mock(ViewHelperService.class);
//        when(mockView.getViewHelperService()).thenReturn(mockViewHelperService);
//        when(mockView.copy()).thenReturn(mockView);
//        when(mockView.clone()).thenReturn(mockView);
        Object nullModel = null;
        Component mockComponent = mock(Component.class);

        // build asterisk required message and mock label to test rendering
        Label mockLabel = mock(Label.class);
        Message message = new Message();
        message.setMessageText("*");
        message.setRender(true);
        when(mockLabel.copy()).thenReturn(mockLabel);
        when(mockLabel.clone()).thenReturn(mockLabel);

        FieldBase fieldBase = new FieldBase();
        fieldBase.setFieldLabel(mockLabel);
        fieldBase.setRequired(true);
        fieldBase.setReadOnly(false);

        fieldBase.<FieldBase> copy().performFinalize(nullModel, mockComponent);
        assertTrue(fieldBase.getFieldLabel().isRenderRequiredIndicator());

        // required and readonly -  do not render
        fieldBase.setReadOnly(true);
        fieldBase.<FieldBase> copy().performFinalize(nullModel, mockComponent);
        assertFalse(fieldBase.getFieldLabel().isRenderRequiredIndicator());
    }
}
@@ -1833,24 +1833,18 @@
 l = 
-mock(Label.class
+new Label(
 );%0A 
@@ -1956,117 +1956,8 @@
 ue);
-%0A        when(mockLabel.copy()).thenReturn(mockLabel);%0A        when(mockLabel.clone()).thenReturn(mockLabel);
 %0A%0A  
@@ -2120,32 +2120,58 @@
 false);%0A%0A       
+ FieldBase fieldBaseCopy =
  fieldBase.%3CFiel
@@ -2175,32 +2175,55 @@
 ieldBase%3E copy()
+;%0A        fieldBaseCopy
 .performFinalize
@@ -2270,32 +2270,36 @@
 rtTrue(fieldBase
+Copy
 .getFieldLabel()
@@ -2389,32 +2389,90 @@
        fieldBase
+Copy = fieldBase.%3CFieldBase%3E copy();%0A        fieldBaseCopy
 .setReadOnly(tru
@@ -2492,35 +2492,20 @@
 ieldBase
-.%3CFieldBase%3E c
+C
 opy
-()
 .perform
@@ -2569,16 +2569,20 @@
 ieldBase
+Copy
 .getFiel

Fix for label test