### Question:
ConditionalComboBoxFieldRenderer extends AbstractComboBoxFieldRenderer<ConditionalComboBoxFieldDefinition> { @Override public void init(final FormRenderingContext renderingContext, ConditionalComboBoxFieldDefinition field) { super.init(renderingContext, field); initializeRelatedFieldCondition(renderingContext, field); } @Inject  ConditionalComboBoxFieldRenderer(@FixedValues final ComboBoxFixedValuesWidgetView comboBoxEditor,
                                            final ClientTranslationService translationService,
                                            final AdapterManager adapterManager); @Override void init(final FormRenderingContext renderingContext,
                     ConditionalComboBoxFieldDefinition field); void refreshFieldCondition(Object conditionValue); @Override String getName(); static final String TYPE_NAME; }### Answer:
@Test public void init() throws Exception { resetMocks(); EmbeddedSubprocess embeddedSubprocess = new EmbeddedSubprocess(); OnEntryAction onEntryAction = embeddedSubprocess.getExecutionSet().getOnEntryAction(); OnExitAction onExitAction = embeddedSubprocess.getExecutionSet().getOnExitAction(); PowerMockito.mockStatic(ClientBindingUtils.class); BDDMockito.given(ClientBindingUtils.getProxiedValue(embeddedSubprocess, "onEntryAction")).willReturn(onEntryAction); BDDMockito.given(ClientBindingUtils.getProxiedValue(embeddedSubprocess, "onExitAction")).willReturn(onExitAction); when(conditionalComboBoxFieldDefinition.getRelatedField()).thenReturn("onEntryAction;onExitAction"); when(renderingContext.getModel()).thenReturn(embeddedSubprocess); when(adapterManager.forProperty()).thenReturn(Mockito.mock(PropertyAdapter.class)); when(adapterManager.forProperty().getValue(onEntryAction)).thenReturn("value"); when(adapterManager.forProperty().getValue(onExitAction)).thenReturn(""); conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition); verify(conditionalComboBoxFieldRenderer, never()).setReadOnly(true); when(adapterManager.forProperty().getValue(onEntryAction)).thenReturn(null); when(adapterManager.forProperty().getValue(onExitAction)).thenReturn(""); conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition); verify(conditionalComboBoxFieldRenderer, times(1)).setReadOnly(false); }
@Test public void initWithDefinitionSet() throws Exception { resetMocks(); SequenceFlow sequenceFlow = new SequenceFlow(); SequenceFlowExecutionSet sequenceFlowExecutionSet = sequenceFlow.getExecutionSet(); ConditionExpression conditionExpression = sequenceFlowExecutionSet.getConditionExpression(); PowerMockito.mockStatic(ClientBindingUtils.class); BDDMockito.given(ClientBindingUtils.getProxiedValue(sequenceFlow, "executionSet")).willReturn(sequenceFlowExecutionSet); BDDMockito.given(ClientBindingUtils.getProxiedValue(sequenceFlowExecutionSet, "conditionExpression")).willReturn(conditionExpression); when(conditionalComboBoxFieldDefinition.getRelatedField()).thenReturn("executionSet.conditionExpression"); when(renderingContext.getModel()).thenReturn(null); when(renderingContext.getParentContext()).thenReturn(renderingContextParent); when(renderingContextParent.getModel()).thenReturn(sequenceFlow); when(adapterManager.forProperty()).thenReturn(Mockito.mock(PropertyAdapter.class)); when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn("value"); conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition); verify(conditionalComboBoxFieldRenderer, never()).setReadOnly(true); verify(conditionalComboBoxFieldRenderer, times(1)).setReadOnly(false); when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn(""); conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition); verify(conditionalComboBoxFieldRenderer, times(1)).setReadOnly(true); when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn(null); conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition); verify(conditionalComboBoxFieldRenderer, atLeastOnce()).setReadOnly(true); }