use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class BaseNameAndDataTypeHeaderMetaDataTest method testSetValueWithHasNameWithoutChange.
@Test
public void testSetValueWithHasNameWithoutChange() {
final Decision decision = new Decision();
decision.setName(NAME);
setup(Optional.of(decision));
metaData.setValue(NAME);
verify(clearValueConsumer, never()).accept(any(HasName.class));
verify(setValueConsumer, never()).accept(any(HasName.class), any(Name.class));
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class BaseNameAndDataTypeHeaderMetaDataTest method testRender.
@Test
public void testRender() {
final QName typeRef = BuiltInType.DATE.asQName();
final GridRenderer renderer = mock(GridRenderer.class);
final GridRendererTheme theme = mock(GridRendererTheme.class);
final Text tName = mock(Text.class);
final InformationItemPrimary hasExpressionVariable = new InformationItemPrimary();
hasExpressionVariable.setTypeRef(typeRef);
hasExpression.setVariable(hasExpressionVariable);
final Decision decision = new Decision();
decision.setName(NAME);
setup(Optional.of(decision));
when(theme.getHeaderText()).thenReturn(tName);
when(context.getRenderer()).thenReturn(renderer);
when(renderer.getTheme()).thenReturn(theme);
when(hasTypeRef.getTypeRef()).thenReturn(typeRef);
metaData.render(context, BLOCK_WIDTH, BLOCK_HEIGHT);
verify(tName).setText(NAME.getValue());
verify(tName, times(2)).setListening(false);
verify(tName, times(2)).setX(BLOCK_WIDTH / 2);
verify(tName).setY(BLOCK_HEIGHT / 2 - SPACING);
verify(tName).setFontStyle(FONT_STYLE_TYPE_REF);
verify(tName).setFontSize(BaseExpressionGridTheme.FONT_SIZE - 2.0);
verify(tName).setText("(" + typeRef.toString() + ")");
verify(tName).setY(BLOCK_HEIGHT / 2 + SPACING);
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class BaseValueAndDataTypeHeaderMetaDataTest method testAsDMNModelInstrumentedBase.
@Test
public void testAsDMNModelInstrumentedBase() {
final Decision decision = new Decision();
setup(Optional.empty());
when(hasTypeRef.asDMNModelInstrumentedBase()).thenReturn(decision);
assertThat(metaData.asDMNModelInstrumentedBase()).isEqualTo(decision);
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class BaseNameAndDataTypeHeaderMetaDataTest method testSetDisplayNameWithHasName.
@Test
public void testSetDisplayNameWithHasName() {
final Decision decision = new Decision();
setup(Optional.of(decision));
metaData.setValue(NAME);
verify(setValueConsumer).accept(eq(decision), eq(NAME));
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class BaseNameAndDataTypeHeaderMetaDataTest method testGetDisplayNameWithHasName.
@Test
public void testGetDisplayNameWithHasName() {
final Decision decision = new Decision();
decision.setName(NAME);
setup(Optional.of(decision));
assertThat(metaData.getValue()).isEqualTo(NAME);
}
Aggregations