method2testcases
stringlengths 118
3.08k
|
---|
### Question:
ImportsValue { @Override public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(defaultImports), Objects.hashCode(wsdlImports)); } ImportsValue(); ImportsValue(@MapsTo("defaultImports") final List<DefaultImport> defaultImports,
@MapsTo("wsdlImports") final List<WSDLImport> wsdlImports); List<DefaultImport> getDefaultImports(); void setDefaultImports(final List<DefaultImport> defaultImports); List<WSDLImport> getWSDLImports(); void setWSDLImports(final List<WSDLImport> wsdlImports); void addImport(final DefaultImport defaultImport); void addImport(final WSDLImport wsdlImport); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }### Answer:
@Test public void testHashCode() { ImportsValue tested1 = new ImportsValue(); ImportsValue tested2 = new ImportsValue(); assertEquals(tested1.hashCode(), tested2.hashCode()); ImportsValue tested3 = new ImportsValue(defaultImports, wsdlImports); ImportsValue tested4 = new ImportsValue(defaultImports, wsdlImports); assertEquals(tested3.hashCode(), tested4.hashCode()); } |
### Question:
DecisionNavigatorPresenter { public void clearSelections() { getTreePresenter().deselectItem(); } @Inject DecisionNavigatorPresenter(final View view,
final DecisionNavigatorTreePresenter treePresenter,
final DecisionComponents decisionComponents,
final DecisionNavigatorObserver decisionNavigatorObserver,
final TranslationService translationService,
final EditorContextProvider context,
final DecisionNavigatorItemsProvider navigatorItemsProvider,
final DMNDiagramsSession dmnDiagramsSession); @WorkbenchPartView View getView(); @WorkbenchPartTitle String getTitle(); @DefaultPosition Position getDefaultPosition(); void onRefreshDecisionComponents(final @Observes RefreshDecisionComponents events); void onElementAdded(final @Observes CanvasElementAddedEvent event); DecisionNavigatorTreePresenter getTreePresenter(); void removeAllElements(); void refresh(); void refreshTreeView(); void enableRefreshHandlers(); void disableRefreshHandlers(); void clearSelections(); static final String IDENTIFIER; }### Answer:
@Test public void testClearSelections() { presenter.clearSelections(); verify(treePresenter).deselectItem(); } |
### Question:
ImportsValue { @Override public String toString() { final Collection<String> defaultImports = getDefaultImports().stream() .map(DefaultImport::toString) .collect(Collectors.toList()); final Collection<String> wsdlImports = getWSDLImports().stream() .map(WSDLImport::toString) .collect(Collectors.toList()); final String serializedValue = Stream.of(defaultImports, wsdlImports) .flatMap(Collection::stream) .collect(Collectors.joining(",")); return serializedValue; } ImportsValue(); ImportsValue(@MapsTo("defaultImports") final List<DefaultImport> defaultImports,
@MapsTo("wsdlImports") final List<WSDLImport> wsdlImports); List<DefaultImport> getDefaultImports(); void setDefaultImports(final List<DefaultImport> defaultImports); List<WSDLImport> getWSDLImports(); void setWSDLImports(final List<WSDLImport> wsdlImports); void addImport(final DefaultImport defaultImport); void addImport(final WSDLImport wsdlImport); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }### Answer:
@Test public void testToString() { ImportsValue tested1 = new ImportsValue(); assertEquals(STRING_EMPTY, tested1.toString()); ImportsValue tested2 = new ImportsValue(defaultImports, wsdlImports); String defaultImpString = buildImportsString(ImportType.DEFAULT, DEFAULT_IMPORTS_QTY); String wsdlImpString = buildImportsString(ImportType.WSDL, WSDL_IMPORTS_QTY); String expected = defaultImpString + "," + wsdlImpString; assertEquals(expected, tested2.toString()); } |
### Question:
Imports implements BPMNProperty { public PropertyType getType() { return type; } Imports(); Imports(@MapsTo("value") final ImportsValue value); PropertyType getType(); ImportsValue getValue(); void setValue(final ImportsValue value); @Override boolean equals(Object o); @Override int hashCode(); @Type
static final PropertyType type; }### Answer:
@Test public void getType() { Imports tested = new Imports(); assertEquals(Imports.type, tested.getType()); } |
### Question:
Imports implements BPMNProperty { public ImportsValue getValue() { return value; } Imports(); Imports(@MapsTo("value") final ImportsValue value); PropertyType getType(); ImportsValue getValue(); void setValue(final ImportsValue value); @Override boolean equals(Object o); @Override int hashCode(); @Type
static final PropertyType type; }### Answer:
@Test public void getValue() { Imports tested = new Imports(importsValue); assertEquals(importsValue, tested.getValue()); } |
### Question:
Imports implements BPMNProperty { public void setValue(final ImportsValue value) { this.value = value; } Imports(); Imports(@MapsTo("value") final ImportsValue value); PropertyType getType(); ImportsValue getValue(); void setValue(final ImportsValue value); @Override boolean equals(Object o); @Override int hashCode(); @Type
static final PropertyType type; }### Answer:
@Test public void setValue() { Imports tested = new Imports(); tested.setValue(importsValue); assertEquals(importsValue, tested.getValue()); } |
### Question:
Imports implements BPMNProperty { @Override public boolean equals(Object o) { if (o instanceof Imports) { Imports other = (Imports) o; return Objects.equals(value, other.value); } return false; } Imports(); Imports(@MapsTo("value") final ImportsValue value); PropertyType getType(); ImportsValue getValue(); void setValue(final ImportsValue value); @Override boolean equals(Object o); @Override int hashCode(); @Type
static final PropertyType type; }### Answer:
@Test public void testEquals() { Imports tested1 = new Imports(); Imports tested2 = new Imports(); assertEquals(tested1, tested2); Imports tested3 = new Imports(importsValue); Imports tested4 = new Imports(importsValue); assertEquals(tested3, tested4); } |
### Question:
Imports implements BPMNProperty { @Override public int hashCode() { return Objects.hashCode(value); } Imports(); Imports(@MapsTo("value") final ImportsValue value); PropertyType getType(); ImportsValue getValue(); void setValue(final ImportsValue value); @Override boolean equals(Object o); @Override int hashCode(); @Type
static final PropertyType type; }### Answer:
@Test public void testHashCode() { Imports tested1 = new Imports(); Imports tested2 = new Imports(); assertEquals(tested1.hashCode(), tested2.hashCode()); Imports tested3 = new Imports(importsValue); Imports tested4 = new Imports(importsValue); assertEquals(tested3.hashCode(), tested4.hashCode()); } |
### Question:
DefaultImport { public String getClassName() { return className; } DefaultImport(); DefaultImport(@MapsTo("className") final String className); static Boolean isValidString(String importValue); static DefaultImport fromString(String importValue); String getClassName(); void setClassName(final String className); @Override String toString(); static final String DELIMITER; static final String IDENTIFIER; }### Answer:
@Test public void getClassName() { DefaultImport tested = new DefaultImport(CLASS_NAME); assertEquals(CLASS_NAME, tested.getClassName()); } |
### Question:
DefaultImport { public void setClassName(final String className) { this.className = className; } DefaultImport(); DefaultImport(@MapsTo("className") final String className); static Boolean isValidString(String importValue); static DefaultImport fromString(String importValue); String getClassName(); void setClassName(final String className); @Override String toString(); static final String DELIMITER; static final String IDENTIFIER; }### Answer:
@Test public void setClassName() { DefaultImport tested = new DefaultImport(); tested.setClassName(CLASS_NAME); assertEquals(CLASS_NAME, tested.getClassName()); } |
### Question:
DefaultImport { @Override public String toString() { if (className == null || className.isEmpty()) { return ""; } else { return IDENTIFIER + "|" + className; } } DefaultImport(); DefaultImport(@MapsTo("className") final String className); static Boolean isValidString(String importValue); static DefaultImport fromString(String importValue); String getClassName(); void setClassName(final String className); @Override String toString(); static final String DELIMITER; static final String IDENTIFIER; }### Answer:
@Test public void testToString() { DefaultImport tested1 = new DefaultImport(); assertEquals(STRING_EMPTY, tested1.toString()); DefaultImport tested2 = new DefaultImport(STRING_EMPTY); assertEquals(STRING_EMPTY, tested2.toString()); DefaultImport tested3 = new DefaultImport(CLASS_NAME); assertEquals(IDENTIFIER + DELIMITER + CLASS_NAME, tested3.toString()); } |
### Question:
DefaultImport { public static Boolean isValidString(String importValue) { String[] importParts = splitImportString(importValue); if (importParts.length != 2) { return false; } if (!importParts[0].equals(IDENTIFIER)) { return false; } if (importParts[1].isEmpty()) { return false; } return true; } DefaultImport(); DefaultImport(@MapsTo("className") final String className); static Boolean isValidString(String importValue); static DefaultImport fromString(String importValue); String getClassName(); void setClassName(final String className); @Override String toString(); static final String DELIMITER; static final String IDENTIFIER; }### Answer:
@Test public void isValidString() { String validString = IDENTIFIER + DELIMITER + CLASS_NAME; assertTrue(DefaultImport.isValidString(validString)); String invalidString1 = IDENTIFIER; assertFalse(DefaultImport.isValidString(invalidString1)); String invalidString2 = IDENTIFIER + DELIMITER + CLASS_NAME + DELIMITER + "invalid"; assertFalse(DefaultImport.isValidString(invalidString2)); String invalidString3 = "invalid" + DELIMITER + CLASS_NAME; assertFalse(DefaultImport.isValidString(invalidString3)); String invalidString4 = IDENTIFIER + DELIMITER + STRING_EMPTY; assertFalse(DefaultImport.isValidString(invalidString4)); } |
### Question:
DecisionNavigatorPresenter { public void onRefreshDecisionComponents(final @Observes RefreshDecisionComponents events) { refreshComponentsView(); } @Inject DecisionNavigatorPresenter(final View view,
final DecisionNavigatorTreePresenter treePresenter,
final DecisionComponents decisionComponents,
final DecisionNavigatorObserver decisionNavigatorObserver,
final TranslationService translationService,
final EditorContextProvider context,
final DecisionNavigatorItemsProvider navigatorItemsProvider,
final DMNDiagramsSession dmnDiagramsSession); @WorkbenchPartView View getView(); @WorkbenchPartTitle String getTitle(); @DefaultPosition Position getDefaultPosition(); void onRefreshDecisionComponents(final @Observes RefreshDecisionComponents events); void onElementAdded(final @Observes CanvasElementAddedEvent event); DecisionNavigatorTreePresenter getTreePresenter(); void removeAllElements(); void refresh(); void refreshTreeView(); void enableRefreshHandlers(); void disableRefreshHandlers(); void clearSelections(); static final String IDENTIFIER; }### Answer:
@Test public void testOnRefreshDecisionComponents() { presenter.disableRefreshHandlers(); presenter.onRefreshDecisionComponents(mock(RefreshDecisionComponents.class)); presenter.onRefreshDecisionComponents(mock(RefreshDecisionComponents.class)); presenter.enableRefreshHandlers(); presenter.onRefreshDecisionComponents(mock(RefreshDecisionComponents.class)); presenter.onRefreshDecisionComponents(mock(RefreshDecisionComponents.class)); verify(decisionComponents, times(2)).refresh(); } |
### Question:
DefaultImport { public static DefaultImport fromString(String importValue) throws Exception { if (!isValidString(importValue)) { throw new Exception("The value: " + importValue + " is not a valid Default Import."); } String[] importParts = splitImportString(importValue); DefaultImport defaultImport = new DefaultImport(importParts[1]); return defaultImport; } DefaultImport(); DefaultImport(@MapsTo("className") final String className); static Boolean isValidString(String importValue); static DefaultImport fromString(String importValue); String getClassName(); void setClassName(final String className); @Override String toString(); static final String DELIMITER; static final String IDENTIFIER; }### Answer:
@Test(expected = Exception.class) public void fromStringInvalid() throws Exception { String invalidString = "invalid" + DELIMITER + CLASS_NAME; DefaultImport.fromString(invalidString); } |
### Question:
WSDLImport { public String getLocation() { return location; } WSDLImport(); WSDLImport(@MapsTo("location") final String location,
@MapsTo("namespace") final String namespace); static Boolean isValidString(String importValue); static WSDLImport fromString(String importValue); String getLocation(); void setLocation(final String location); String getNamespace(); void setNamespace(final String namespace); @Override String toString(); }### Answer:
@Test public void getLocation() { WSDLImport tested = new WSDLImport(LOCATION, NAMESPACE); assertEquals(LOCATION, tested.getLocation()); } |
### Question:
WSDLImport { public void setLocation(final String location) { this.location = location; } WSDLImport(); WSDLImport(@MapsTo("location") final String location,
@MapsTo("namespace") final String namespace); static Boolean isValidString(String importValue); static WSDLImport fromString(String importValue); String getLocation(); void setLocation(final String location); String getNamespace(); void setNamespace(final String namespace); @Override String toString(); }### Answer:
@Test public void setLocation() { WSDLImport tested = new WSDLImport(); tested.setLocation(LOCATION); assertEquals(LOCATION, tested.getLocation()); } |
### Question:
WSDLImport { public String getNamespace() { return namespace; } WSDLImport(); WSDLImport(@MapsTo("location") final String location,
@MapsTo("namespace") final String namespace); static Boolean isValidString(String importValue); static WSDLImport fromString(String importValue); String getLocation(); void setLocation(final String location); String getNamespace(); void setNamespace(final String namespace); @Override String toString(); }### Answer:
@Test public void getNamespace() { WSDLImport tested = new WSDLImport(LOCATION, NAMESPACE); assertEquals(NAMESPACE, tested.getNamespace()); } |
### Question:
WSDLImport { public void setNamespace(final String namespace) { this.namespace = namespace; } WSDLImport(); WSDLImport(@MapsTo("location") final String location,
@MapsTo("namespace") final String namespace); static Boolean isValidString(String importValue); static WSDLImport fromString(String importValue); String getLocation(); void setLocation(final String location); String getNamespace(); void setNamespace(final String namespace); @Override String toString(); }### Answer:
@Test public void setNamespace() { WSDLImport tested = new WSDLImport(); tested.setNamespace(NAMESPACE); assertEquals(NAMESPACE, tested.getNamespace()); } |
### Question:
WSDLImport { @Override public String toString() { if (location == null || namespace == null || location.isEmpty() || namespace.isEmpty()) { return ""; } else { return IDENTIFIER + DELIMITER + location + DELIMITER + namespace; } } WSDLImport(); WSDLImport(@MapsTo("location") final String location,
@MapsTo("namespace") final String namespace); static Boolean isValidString(String importValue); static WSDLImport fromString(String importValue); String getLocation(); void setLocation(final String location); String getNamespace(); void setNamespace(final String namespace); @Override String toString(); }### Answer:
@Test public void testToString() { WSDLImport tested1 = new WSDLImport(); assertEquals(STRING_EMPTY, tested1.toString()); WSDLImport tested2 = new WSDLImport(STRING_EMPTY, STRING_EMPTY); assertEquals(STRING_EMPTY, tested2.toString()); WSDLImport tested3 = new WSDLImport(LOCATION, NAMESPACE); assertEquals(tested3.toString(), IDENTIFIER + DELIMITER + LOCATION + DELIMITER + NAMESPACE); } |
### Question:
WSDLImport { public static Boolean isValidString(String importValue) { String[] importParts = splitImportString(importValue); if (importParts.length != 3) { return false; } if (!importParts[0].equals(IDENTIFIER)) { return false; } if (importParts[1].isEmpty()) { return false; } if (importParts[2].isEmpty()) { return false; } return true; } WSDLImport(); WSDLImport(@MapsTo("location") final String location,
@MapsTo("namespace") final String namespace); static Boolean isValidString(String importValue); static WSDLImport fromString(String importValue); String getLocation(); void setLocation(final String location); String getNamespace(); void setNamespace(final String namespace); @Override String toString(); }### Answer:
@Test public void isValidString() { String validString = IDENTIFIER + DELIMITER + LOCATION + DELIMITER + NAMESPACE; assertTrue(WSDLImport.isValidString(validString)); String invalidString1 = IDENTIFIER + DELIMITER + LOCATION; assertFalse(WSDLImport.isValidString(invalidString1)); String invalidString2 = IDENTIFIER + DELIMITER + LOCATION + DELIMITER + NAMESPACE + DELIMITER + "invalid"; assertFalse(WSDLImport.isValidString(invalidString2)); String invalidString3 = "invalid" + DELIMITER + LOCATION + DELIMITER + NAMESPACE; assertFalse(WSDLImport.isValidString(invalidString3)); String invalidString4 = IDENTIFIER + DELIMITER + STRING_EMPTY + DELIMITER + STRING_EMPTY; assertFalse(WSDLImport.isValidString(invalidString4)); String invalidString5 = IDENTIFIER + DELIMITER + STRING_EMPTY + DELIMITER + NAMESPACE; assertFalse(WSDLImport.isValidString(invalidString5)); String invalidString6 = IDENTIFIER + DELIMITER + LOCATION + DELIMITER + STRING_EMPTY; assertFalse(WSDLImport.isValidString(invalidString6)); } |
### Question:
WSDLImport { public static WSDLImport fromString(String importValue) throws Exception { if (!isValidString(importValue)) { throw new Exception("The value: " + importValue + " is not a valid WSDL Import."); } String[] importParts = splitImportString(importValue); WSDLImport wsdlImport = new WSDLImport(importParts[1], importParts[2]); return wsdlImport; } WSDLImport(); WSDLImport(@MapsTo("location") final String location,
@MapsTo("namespace") final String namespace); static Boolean isValidString(String importValue); static WSDLImport fromString(String importValue); String getLocation(); void setLocation(final String location); String getNamespace(); void setNamespace(final String namespace); @Override String toString(); }### Answer:
@Test(expected = Exception.class) public void fromStringInvalid() throws Exception { String invalidString = "invalid" + DELIMITER + LOCATION + DELIMITER + NAMESPACE; WSDLImport.fromString(invalidString); } |
### Question:
BaseSubprocessTaskExecutionSet implements BPMNPropertySet { public IsAsync getIsAsync() { return isAsync; } BaseSubprocessTaskExecutionSet(); BaseSubprocessTaskExecutionSet(final @MapsTo("isAsync") IsAsync isAsync,
final @MapsTo("slaDueDate") SLADueDate slaDueDate); IsAsync getIsAsync(); void setIsAsync(IsAsync isAsync); SLADueDate getSlaDueDate(); void setSlaDueDate(final SLADueDate slaDueDate); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void testGetIsAsync() { BaseSubprocessTaskExecutionSet a = new BaseSubprocessTaskExecutionSet(); Assert.assertEquals(new IsAsync(), a.getIsAsync()); } |
### Question:
DecisionNavigatorPresenter { public void onElementAdded(final @Observes CanvasElementAddedEvent event) { refreshComponentsView(); } @Inject DecisionNavigatorPresenter(final View view,
final DecisionNavigatorTreePresenter treePresenter,
final DecisionComponents decisionComponents,
final DecisionNavigatorObserver decisionNavigatorObserver,
final TranslationService translationService,
final EditorContextProvider context,
final DecisionNavigatorItemsProvider navigatorItemsProvider,
final DMNDiagramsSession dmnDiagramsSession); @WorkbenchPartView View getView(); @WorkbenchPartTitle String getTitle(); @DefaultPosition Position getDefaultPosition(); void onRefreshDecisionComponents(final @Observes RefreshDecisionComponents events); void onElementAdded(final @Observes CanvasElementAddedEvent event); DecisionNavigatorTreePresenter getTreePresenter(); void removeAllElements(); void refresh(); void refreshTreeView(); void enableRefreshHandlers(); void disableRefreshHandlers(); void clearSelections(); static final String IDENTIFIER; }### Answer:
@Test public void testOnElementAdded() { presenter.disableRefreshHandlers(); presenter.onElementAdded(mock(CanvasElementAddedEvent.class)); presenter.onElementAdded(mock(CanvasElementAddedEvent.class)); presenter.enableRefreshHandlers(); presenter.onElementAdded(mock(CanvasElementAddedEvent.class)); presenter.onElementAdded(mock(CanvasElementAddedEvent.class)); verify(decisionComponents, times(2)).refresh(); } |
### Question:
BaseSubprocessTaskExecutionSet implements BPMNPropertySet { public void setIsAsync(IsAsync isAsync) { this.isAsync = isAsync; } BaseSubprocessTaskExecutionSet(); BaseSubprocessTaskExecutionSet(final @MapsTo("isAsync") IsAsync isAsync,
final @MapsTo("slaDueDate") SLADueDate slaDueDate); IsAsync getIsAsync(); void setIsAsync(IsAsync isAsync); SLADueDate getSlaDueDate(); void setSlaDueDate(final SLADueDate slaDueDate); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void testSetIsAsync() { final IsAsync isAsyncFalse = new IsAsync(false); final IsAsync isAsyncTrue = new IsAsync(true); final BaseSubprocessTaskExecutionSet a = new BaseSubprocessTaskExecutionSet(); a.setIsAsync(isAsyncFalse); final BaseSubprocessTaskExecutionSet b = new BaseSubprocessTaskExecutionSet(); b.setIsAsync(isAsyncTrue); Assert.assertEquals(isAsyncFalse, a.getIsAsync()); Assert.assertEquals(isAsyncTrue, b.getIsAsync()); } |
### Question:
BaseSubprocessTaskExecutionSet implements BPMNPropertySet { public SLADueDate getSlaDueDate() { return slaDueDate; } BaseSubprocessTaskExecutionSet(); BaseSubprocessTaskExecutionSet(final @MapsTo("isAsync") IsAsync isAsync,
final @MapsTo("slaDueDate") SLADueDate slaDueDate); IsAsync getIsAsync(); void setIsAsync(IsAsync isAsync); SLADueDate getSlaDueDate(); void setSlaDueDate(final SLADueDate slaDueDate); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void testGetSlaDueDate() { BaseSubprocessTaskExecutionSet a = new BaseSubprocessTaskExecutionSet(); Assert.assertEquals(new SLADueDate(), a.getSlaDueDate()); } |
### Question:
BaseSubprocessTaskExecutionSet implements BPMNPropertySet { public void setSlaDueDate(final SLADueDate slaDueDate) { this.slaDueDate = slaDueDate; } BaseSubprocessTaskExecutionSet(); BaseSubprocessTaskExecutionSet(final @MapsTo("isAsync") IsAsync isAsync,
final @MapsTo("slaDueDate") SLADueDate slaDueDate); IsAsync getIsAsync(); void setIsAsync(IsAsync isAsync); SLADueDate getSlaDueDate(); void setSlaDueDate(final SLADueDate slaDueDate); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void testSetSlaDueDate() { final String SLA_DUE_DATE_VALUE = "12/25/1983"; final SLADueDate slaDueDate = new SLADueDate(SLA_DUE_DATE_VALUE); final BaseSubprocessTaskExecutionSet a = new BaseSubprocessTaskExecutionSet(); a.setSlaDueDate(slaDueDate); Assert.assertEquals(slaDueDate, a.getSlaDueDate()); } |
### Question:
BaseSubprocessTaskExecutionSet implements BPMNPropertySet { @Override public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(isAsync), Objects.hashCode(slaDueDate)); } BaseSubprocessTaskExecutionSet(); BaseSubprocessTaskExecutionSet(final @MapsTo("isAsync") IsAsync isAsync,
final @MapsTo("slaDueDate") SLADueDate slaDueDate); IsAsync getIsAsync(); void setIsAsync(IsAsync isAsync); SLADueDate getSlaDueDate(); void setSlaDueDate(final SLADueDate slaDueDate); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void testHashCode() { BaseSubprocessTaskExecutionSet a = new BaseSubprocessTaskExecutionSet(); BaseSubprocessTaskExecutionSet b = new BaseSubprocessTaskExecutionSet(); assertEquals(a.hashCode(), b.hashCode()); } |
### Question:
BaseSubprocessTaskExecutionSet implements BPMNPropertySet { @Override public boolean equals(Object o) { if (o instanceof BaseSubprocessTaskExecutionSet) { BaseSubprocessTaskExecutionSet other = (BaseSubprocessTaskExecutionSet) o; return Objects.equals(isAsync, other.isAsync) && Objects.equals(slaDueDate, other.slaDueDate); } return false; } BaseSubprocessTaskExecutionSet(); BaseSubprocessTaskExecutionSet(final @MapsTo("isAsync") IsAsync isAsync,
final @MapsTo("slaDueDate") SLADueDate slaDueDate); IsAsync getIsAsync(); void setIsAsync(IsAsync isAsync); SLADueDate getSlaDueDate(); void setSlaDueDate(final SLADueDate slaDueDate); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void testEquals() { BaseSubprocessTaskExecutionSet a = new BaseSubprocessTaskExecutionSet(); BaseSubprocessTaskExecutionSet b = new BaseSubprocessTaskExecutionSet(); Assert.assertEquals(a, b); } |
### Question:
IsCase implements BPMNProperty { public void setValue(final Boolean value) { this.value = value; } IsCase(); IsCase(final Boolean value); Boolean getValue(); void setValue(final Boolean value); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void testValueInvalid() { tested.setValue(CASE_INVALID); Set<ConstraintViolation<IsCase>> violations = this.validator.validate(tested); assertEquals(1, violations.size()); } |
### Question:
ProcessVariableSerializer { public static Map<String, VariableInfo> deserialize(String serializedVariables) { return Stream.of(serializedVariables.split(",")) .filter(s -> !s.isEmpty()) .map(ProcessVariableSerializer::deserializeVariable) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } static Map<String, VariableInfo> deserialize(String serializedVariables); }### Answer:
@Test public void deserialize() { final Map<String, ProcessVariableSerializer.VariableInfo> deserialized = ProcessVariableSerializer.deserialize(VARIABLE); assertEquals(deserialized.size(), 2); assertEquals(deserialized.get("PV1").getType(), "java.lang.String"); assertEquals(deserialized.get("PV1").getTags(), "[internal;output]"); assertEquals(deserialized.get("PV2").getType(), "java.lang.Boolean"); assertEquals(deserialized.get("PV2").getTags(), "[internal;readonly;customTag]"); } |
### Question:
TextAnnotation extends BaseArtifacts { public Set<String> getLabels() { return labels; } TextAnnotation(); TextAnnotation(final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void getLabels() { assertEquals(3, tested.getLabels().size()); assertTrue(tested.getLabels().contains("all")); assertTrue(tested.getLabels().contains("lane_child")); assertTrue(tested.getLabels().contains("text_annotation")); } |
### Question:
TextAnnotation extends BaseArtifacts { public BPMNGeneralSet getGeneral() { return general; } TextAnnotation(); TextAnnotation(final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void getGeneral() { assertNotNull(tested.getGeneral()); }
@Test public void setName() { Name name = new Name(this.getClass().getSimpleName()); tested.getGeneral().setName(name); assertEquals(name, tested.getGeneral().getName()); }
@Test public void setDocumentation() { Documentation documentation = new Documentation(this.getClass().getSimpleName()); tested.getGeneral().setDocumentation(documentation); assertEquals(documentation, tested.getGeneral().getDocumentation()); } |
### Question:
DecisionNavigatorItem implements Comparable { public void onClick() { getOnClick().ifPresent(Command::execute); } String getUUID(); String getLabel(); Type getType(); TreeSet<DecisionNavigatorItem> getChildren(); Optional<Command> getOnClick(); String getParentUUID(); void setLabel(final String label); void removeChild(final DecisionNavigatorItem item); void addChild(final DecisionNavigatorItem item); void onClick(); void onUpdate(); void onRemove(); boolean isEditable(); @Override boolean equals(final Object o); @Override int hashCode(); @Override int compareTo(final Object o); }### Answer:
@Test public void testOnClick() { final Command command = mock(Command.class); final DecisionNavigatorItem item = new DecisionNavigatorItemBuilder().withUUID("uuid").withLabel("label").withType(ITEM).withOnClick(command).build(); item.onClick(); verify(command).execute(); } |
### Question:
TextAnnotation extends BaseArtifacts { public void setGeneral(final BPMNGeneralSet general) { this.general = general; } TextAnnotation(); TextAnnotation(final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void setGeneral() { BPMNGeneralSet general = new BPMNGeneralSet(); tested.setGeneral(general); assertEquals(general, tested.getGeneral()); } |
### Question:
TextAnnotation extends BaseArtifacts { @Override public int hashCode() { return HashUtil.combineHashCodes(general.hashCode(), backgroundSet.hashCode(), fontSet.hashCode(), dimensionsSet.hashCode()); } TextAnnotation(); TextAnnotation(final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void testHashCode() { assertEquals(new TextAnnotation().hashCode(), tested.hashCode()); } |
### Question:
TextAnnotation extends BaseArtifacts { @Override public boolean equals(Object o) { if (o instanceof TextAnnotation) { TextAnnotation other = (TextAnnotation) o; return general.equals(other.general) && backgroundSet.equals(other.backgroundSet) && fontSet.equals(other.fontSet) && dimensionsSet.equals(other.dimensionsSet); } return false; } TextAnnotation(); TextAnnotation(final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void testEquals() { assertEquals(new TextAnnotation(), tested); assertNotEquals(new TextAnnotation(), new Object()); } |
### Question:
DataObject extends BaseArtifacts { public Set<String> getLabels() { return labels; } DataObject(); DataObject(final @MapsTo("name") Name name,
final @MapsTo("type") DataObjectType type,
final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); Name getName(); void setName(Name name); DataObjectType getType(); void setType(DataObjectType type); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void getLabels() { assertEquals(2, dataObject.getLabels().size()); assertEquals(true, dataObject.getLabels().contains("all")); assertEquals(true, dataObject.getLabels().contains("lane_child")); } |
### Question:
DataObject extends BaseArtifacts { public BPMNGeneralSet getGeneral() { return general; } DataObject(); DataObject(final @MapsTo("name") Name name,
final @MapsTo("type") DataObjectType type,
final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); Name getName(); void setName(Name name); DataObjectType getType(); void setType(DataObjectType type); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void getGeneral() { assertNotNull(dataObject.getGeneral()); } |
### Question:
DataObject extends BaseArtifacts { public void setGeneral(final BPMNGeneralSet general) { this.general = general; } DataObject(); DataObject(final @MapsTo("name") Name name,
final @MapsTo("type") DataObjectType type,
final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); Name getName(); void setName(Name name); DataObjectType getType(); void setType(DataObjectType type); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void setGeneral() { BPMNGeneralSet general = new BPMNGeneralSet(); dataObject.setGeneral(general); assertEquals(general, dataObject.getGeneral()); } |
### Question:
DataObject extends BaseArtifacts { public void setName(Name name) { this.name = name; } DataObject(); DataObject(final @MapsTo("name") Name name,
final @MapsTo("type") DataObjectType type,
final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); Name getName(); void setName(Name name); DataObjectType getType(); void setType(DataObjectType type); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void setName() { Name name = new Name(this.getClass().getSimpleName()); dataObject.setName(name); assertEquals(name, dataObject.getName()); } |
### Question:
DataObject extends BaseArtifacts { public void setType(DataObjectType type) { this.type = type; } DataObject(); DataObject(final @MapsTo("name") Name name,
final @MapsTo("type") DataObjectType type,
final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); Name getName(); void setName(Name name); DataObjectType getType(); void setType(DataObjectType type); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void setType() { DataObjectType type = new DataObjectType(new DataObjectTypeValue(this.getClass().getSimpleName())); dataObject.setType(type); assertEquals(type, dataObject.getType()); } |
### Question:
DecisionNavigatorItem implements Comparable { public void removeChild(final DecisionNavigatorItem item) { getChildren().removeIf(i -> i.getUUID().equals(item.getUUID())); } String getUUID(); String getLabel(); Type getType(); TreeSet<DecisionNavigatorItem> getChildren(); Optional<Command> getOnClick(); String getParentUUID(); void setLabel(final String label); void removeChild(final DecisionNavigatorItem item); void addChild(final DecisionNavigatorItem item); void onClick(); void onUpdate(); void onRemove(); boolean isEditable(); @Override boolean equals(final Object o); @Override int hashCode(); @Override int compareTo(final Object o); }### Answer:
@Test public void testRemoveChild() { final DecisionNavigatorItem item = new DecisionNavigatorItemBuilder().withUUID("uuid").build(); final DecisionNavigatorItem child = new DecisionNavigatorItemBuilder().withUUID("child").build(); item.getChildren().add(child); item.removeChild(child); assertEquals(Collections.emptySet(), item.getChildren()); } |
### Question:
DataObject extends BaseArtifacts { @Override public int hashCode() { return HashUtil.combineHashCodes(name.hashCode(), type.hashCode(), general.hashCode(), backgroundSet.hashCode(), fontSet.hashCode(), dimensionsSet.hashCode()); } DataObject(); DataObject(final @MapsTo("name") Name name,
final @MapsTo("type") DataObjectType type,
final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); Name getName(); void setName(Name name); DataObjectType getType(); void setType(DataObjectType type); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void testHashCode() { assertEquals(new DataObject().hashCode(), dataObject.hashCode()); } |
### Question:
DataObject extends BaseArtifacts { @Override public boolean equals(Object o) { if (o instanceof DataObject) { DataObject other = (DataObject) o; return name.equals(other.name) && type.equals(other.type) && general.equals(other.general) && backgroundSet.equals(other.backgroundSet) && fontSet.equals(other.fontSet) && dimensionsSet.equals(other.dimensionsSet); } return false; } DataObject(); DataObject(final @MapsTo("name") Name name,
final @MapsTo("type") DataObjectType type,
final @MapsTo("general") BPMNGeneralSet general,
final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); Set<String> getLabels(); BPMNGeneralSet getGeneral(); void setGeneral(final BPMNGeneralSet general); Name getName(); void setName(Name name); DataObjectType getType(); void setType(DataObjectType type); @Override int hashCode(); @Override boolean equals(Object o); }### Answer:
@Test public void testEquals() { assertEquals(new DataObject(), dataObject); assertNotEquals(new DataObject(), new Object()); } |
### Question:
BaseArtifacts implements BPMNViewDefinition { public String getCategory() { return category; } BaseArtifacts(final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); String getCategory(); BackgroundSet getBackgroundSet(); FontSet getFontSet(); RectangleDimensionsSet getDimensionsSet(); void setBackgroundSet(final BackgroundSet backgroundSet); void setFontSet(final FontSet fontSet); void setDimensionsSet(final RectangleDimensionsSet dimensionsSet); @Override int hashCode(); @Override boolean equals(Object o); @Category
static final transient String category; }### Answer:
@Test public void getCategory() { assertNotNull(tested.getCategory()); } |
### Question:
BaseArtifacts implements BPMNViewDefinition { public BackgroundSet getBackgroundSet() { return backgroundSet; } BaseArtifacts(final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); String getCategory(); BackgroundSet getBackgroundSet(); FontSet getFontSet(); RectangleDimensionsSet getDimensionsSet(); void setBackgroundSet(final BackgroundSet backgroundSet); void setFontSet(final FontSet fontSet); void setDimensionsSet(final RectangleDimensionsSet dimensionsSet); @Override int hashCode(); @Override boolean equals(Object o); @Category
static final transient String category; }### Answer:
@Test public void getBackgroundSet() { assertNotNull(tested.getBackgroundSet()); } |
### Question:
BaseArtifacts implements BPMNViewDefinition { public FontSet getFontSet() { return fontSet; } BaseArtifacts(final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); String getCategory(); BackgroundSet getBackgroundSet(); FontSet getFontSet(); RectangleDimensionsSet getDimensionsSet(); void setBackgroundSet(final BackgroundSet backgroundSet); void setFontSet(final FontSet fontSet); void setDimensionsSet(final RectangleDimensionsSet dimensionsSet); @Override int hashCode(); @Override boolean equals(Object o); @Category
static final transient String category; }### Answer:
@Test public void getFontSet() { assertNotNull(tested.getFontSet()); } |
### Question:
BaseArtifacts implements BPMNViewDefinition { public RectangleDimensionsSet getDimensionsSet() { return dimensionsSet; } BaseArtifacts(final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); String getCategory(); BackgroundSet getBackgroundSet(); FontSet getFontSet(); RectangleDimensionsSet getDimensionsSet(); void setBackgroundSet(final BackgroundSet backgroundSet); void setFontSet(final FontSet fontSet); void setDimensionsSet(final RectangleDimensionsSet dimensionsSet); @Override int hashCode(); @Override boolean equals(Object o); @Category
static final transient String category; }### Answer:
@Test public void getDimensionsSet() { assertNotNull(tested.getDimensionsSet()); } |
### Question:
BaseArtifacts implements BPMNViewDefinition { public void setBackgroundSet(final BackgroundSet backgroundSet) { this.backgroundSet = backgroundSet; } BaseArtifacts(final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); String getCategory(); BackgroundSet getBackgroundSet(); FontSet getFontSet(); RectangleDimensionsSet getDimensionsSet(); void setBackgroundSet(final BackgroundSet backgroundSet); void setFontSet(final FontSet fontSet); void setDimensionsSet(final RectangleDimensionsSet dimensionsSet); @Override int hashCode(); @Override boolean equals(Object o); @Category
static final transient String category; }### Answer:
@Test public void setBackgroundSet() { BackgroundSet backgroundSet = new BackgroundSet(); tested.setBackgroundSet(backgroundSet); assertEquals(backgroundSet, tested.getBackgroundSet()); } |
### Question:
BaseArtifacts implements BPMNViewDefinition { public void setFontSet(final FontSet fontSet) { this.fontSet = fontSet; } BaseArtifacts(final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); String getCategory(); BackgroundSet getBackgroundSet(); FontSet getFontSet(); RectangleDimensionsSet getDimensionsSet(); void setBackgroundSet(final BackgroundSet backgroundSet); void setFontSet(final FontSet fontSet); void setDimensionsSet(final RectangleDimensionsSet dimensionsSet); @Override int hashCode(); @Override boolean equals(Object o); @Category
static final transient String category; }### Answer:
@Test public void setFontSet() { FontSet fontSet = new FontSet(); tested.setFontSet(fontSet); assertEquals(fontSet, tested.getFontSet()); } |
### Question:
BaseArtifacts implements BPMNViewDefinition { public void setDimensionsSet(final RectangleDimensionsSet dimensionsSet) { this.dimensionsSet = dimensionsSet; } BaseArtifacts(final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); String getCategory(); BackgroundSet getBackgroundSet(); FontSet getFontSet(); RectangleDimensionsSet getDimensionsSet(); void setBackgroundSet(final BackgroundSet backgroundSet); void setFontSet(final FontSet fontSet); void setDimensionsSet(final RectangleDimensionsSet dimensionsSet); @Override int hashCode(); @Override boolean equals(Object o); @Category
static final transient String category; }### Answer:
@Test public void setDimensionsSet() { RectangleDimensionsSet dimensionsSet = new RectangleDimensionsSet(); tested.setDimensionsSet(dimensionsSet); assertEquals(dimensionsSet, tested.getDimensionsSet()); } |
### Question:
BaseArtifacts implements BPMNViewDefinition { @Override public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(backgroundSet), Objects.hashCode(fontSet), Objects.hashCode(dimensionsSet)); } BaseArtifacts(final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); String getCategory(); BackgroundSet getBackgroundSet(); FontSet getFontSet(); RectangleDimensionsSet getDimensionsSet(); void setBackgroundSet(final BackgroundSet backgroundSet); void setFontSet(final FontSet fontSet); void setDimensionsSet(final RectangleDimensionsSet dimensionsSet); @Override int hashCode(); @Override boolean equals(Object o); @Category
static final transient String category; }### Answer:
@Test public void testHashCode() { assertNotEquals(new DataObject().hashCode(), tested.hashCode()); assertNotEquals(new TextAnnotation().hashCode(), tested.hashCode()); } |
### Question:
DecisionNavigatorItem implements Comparable { public void addChild(final DecisionNavigatorItem item) { removeChild(item); getChildren().add(item); item.setParentUUID(uuid); } String getUUID(); String getLabel(); Type getType(); TreeSet<DecisionNavigatorItem> getChildren(); Optional<Command> getOnClick(); String getParentUUID(); void setLabel(final String label); void removeChild(final DecisionNavigatorItem item); void addChild(final DecisionNavigatorItem item); void onClick(); void onUpdate(); void onRemove(); boolean isEditable(); @Override boolean equals(final Object o); @Override int hashCode(); @Override int compareTo(final Object o); }### Answer:
@Test public void testAddChild() { final DecisionNavigatorItem item = new DecisionNavigatorItemBuilder().withUUID("uuid").build(); final DecisionNavigatorItem child = new DecisionNavigatorItemBuilder().withUUID("child").build(); final TreeSet<DecisionNavigatorItem> expectedChildren = new TreeSet<DecisionNavigatorItem>() {{ add(child); }}; item.addChild(child); item.addChild(child); assertEquals(expectedChildren, item.getChildren()); } |
### Question:
BaseArtifacts implements BPMNViewDefinition { @Override public boolean equals(Object o) { if (o instanceof BaseArtifacts) { BaseArtifacts other = (BaseArtifacts) o; return Objects.equals(backgroundSet, other.backgroundSet) && Objects.equals(fontSet, other.fontSet) && Objects.equals(dimensionsSet, other.dimensionsSet); } return false; } BaseArtifacts(final @MapsTo("backgroundSet") BackgroundSet backgroundSet,
final @MapsTo("fontSet") FontSet fontSet,
final @MapsTo("dimensionsSet") RectangleDimensionsSet dimensionsSet); String getCategory(); BackgroundSet getBackgroundSet(); FontSet getFontSet(); RectangleDimensionsSet getDimensionsSet(); void setBackgroundSet(final BackgroundSet backgroundSet); void setFontSet(final FontSet fontSet); void setDimensionsSet(final RectangleDimensionsSet dimensionsSet); @Override int hashCode(); @Override boolean equals(Object o); @Category
static final transient String category; }### Answer:
@Test public void testEquals() { assertTrue(tested.equals(new DataObject())); assertFalse(tested.equals("")); final DataObject dataObject = new DataObject(); BgColor color = new BgColor(); color.setValue("Black"); dataObject.getBackgroundSet().setBgColor(color); assertFalse(tested.equals(dataObject)); tested.getBackgroundSet().setBgColor(color); assertTrue(tested.equals(dataObject)); dataObject.getFontSet().setFontSize(new FontSize(11.0)); assertFalse(tested.equals(dataObject)); tested.getFontSet().setFontSize(new FontSize(11.0)); assertTrue(tested.equals(dataObject)); dataObject.getDimensionsSet().setHeight(new Height(11.0)); assertFalse(tested.equals(dataObject)); tested.getDimensionsSet().setHeight(new Height(11.0)); assertTrue(tested.equals(dataObject)); } |
### Question:
CaseManagementSwitchViewServiceImpl implements CaseManagementSwitchViewService { @PostConstruct public void init() { definitionSetServiceInstances.forEach(i -> definitionSetServices.add(i)); } @Inject CaseManagementSwitchViewServiceImpl(final FactoryManager factoryManager,
final Instance<DefinitionSetService> definitionSetServiceInstances); @PostConstruct void init(); @Override @SuppressWarnings("unchecked") Optional<ProjectDiagram> switchView(final Diagram diagram, final String mappedDefSetId, final String mappedShapeSetId); }### Answer:
@Test public void testInit() { final List<DefinitionSetService> definitionSetServices = new LinkedList<>(); final DefinitionSetService definitionSetService1 = mock(DefinitionSetService.class); final DefinitionSetService definitionSetService2 = mock(DefinitionSetService.class); definitionSetServices.add(definitionSetService1); definitionSetServices.add(definitionSetService2); when(definitionSetServiceInstances.iterator()).thenReturn(definitionSetServices.iterator()); doAnswer(invocation -> { final Consumer consumer = invocation.getArgumentAt(0, Consumer.class); Iterator var2 = definitionSetServiceInstances.iterator(); while (var2.hasNext()) { Object t = var2.next(); consumer.accept(t); } return null; }).when(definitionSetServiceInstances).forEach(any(Consumer.class)); tested.init(); assertEquals(tested.definitionSetServices.size(), definitionSetServices.size()); tested.definitionSetServices.containsAll(definitionSetServices); } |
### Question:
CaseManagementProjectDiagramFactory extends BindableDiagramFactory<ProjectMetadata, ProjectDiagram> { @PostConstruct public void init() { this.bpmnDiagramFactory.setDiagramType(CaseManagementDiagram.class); } protected CaseManagementProjectDiagramFactory(); @Inject CaseManagementProjectDiagramFactory(final BPMNProjectDiagramFactory bpmnDiagramFactory); @PostConstruct void init(); @Override Class<? extends Metadata> getMetadataType(); @Override ProjectDiagram build(final String name,
final ProjectMetadata metadata,
final Graph<DefinitionSet, ?> graph); }### Answer:
@Test public void assertDiagamType() { factory.init(); verify(bpmnDiagramFactory, times(1)).setDiagramType(eq(CaseManagementDiagram.class)); } |
### Question:
CaseManagementProjectDiagramFactory extends BindableDiagramFactory<ProjectMetadata, ProjectDiagram> { @Override protected Class<?> getDefinitionSetType() { return CaseManagementDefinitionSet.class; } protected CaseManagementProjectDiagramFactory(); @Inject CaseManagementProjectDiagramFactory(final BPMNProjectDiagramFactory bpmnDiagramFactory); @PostConstruct void init(); @Override Class<? extends Metadata> getMetadataType(); @Override ProjectDiagram build(final String name,
final ProjectMetadata metadata,
final Graph<DefinitionSet, ?> graph); }### Answer:
@Test public void assertDefinitionSetType() { assertEquals(CaseManagementDefinitionSet.class, factory.getDefinitionSetType()); } |
### Question:
CaseManagementProjectDiagramFactory extends BindableDiagramFactory<ProjectMetadata, ProjectDiagram> { @Override public Class<? extends Metadata> getMetadataType() { return ProjectMetadata.class; } protected CaseManagementProjectDiagramFactory(); @Inject CaseManagementProjectDiagramFactory(final BPMNProjectDiagramFactory bpmnDiagramFactory); @PostConstruct void init(); @Override Class<? extends Metadata> getMetadataType(); @Override ProjectDiagram build(final String name,
final ProjectMetadata metadata,
final Graph<DefinitionSet, ?> graph); }### Answer:
@Test public void assertMetadataType() { assertEquals(ProjectMetadata.class, factory.getMetadataType()); } |
### Question:
CaseManagementProjectDiagramFactory extends BindableDiagramFactory<ProjectMetadata, ProjectDiagram> { @Override public ProjectDiagram build(final String name, final ProjectMetadata metadata, final Graph<DefinitionSet, ?> graph) { return bpmnDiagramFactory.build(name, metadata, graph); } protected CaseManagementProjectDiagramFactory(); @Inject CaseManagementProjectDiagramFactory(final BPMNProjectDiagramFactory bpmnDiagramFactory); @PostConstruct void init(); @Override Class<? extends Metadata> getMetadataType(); @Override ProjectDiagram build(final String name,
final ProjectMetadata metadata,
final Graph<DefinitionSet, ?> graph); }### Answer:
@Test @SuppressWarnings("unchecked") public void testBuild() { factory.init(); factory.build("diagram1", metadata, graph); verify(bpmnDiagramFactory, times(1)).build(eq("diagram1"), eq(metadata), eq(graph)); } |
### Question:
CaseManagementShapeCommand { public static CaseManagementShape create(Object definition, CaseManagementShapeView shapeView, CaseManagementSvgShapeDef shapeDef) { Command command = CM_SHAPE_TYPES.get(definition.getClass()); if (command == null) { return null; } applyShapeViewHandlers(definition, shapeView, shapeDef); return command.configure(shapeView, shapeDef); } static CaseManagementShape create(Object definition, CaseManagementShapeView shapeView, CaseManagementSvgShapeDef shapeDef); }### Answer:
@Test public void create() { CaseManagementShape shape = CaseManagementShapeCommand.create(def, shapeView, shapeDef); verify(shapeDef).fontHandler(); verify(shapeView).setTitlePosition(HasTitle.VerticalAlignment.MIDDLE, HasTitle.HorizontalAlignment.CENTER, HasTitle.ReferencePosition.INSIDE, HasTitle.Orientation.HORIZONTAL); verify(shapeView).setTextSizeConstraints(new HasTitle.Size(100, 100, HasTitle.Size.SizeType.PERCENTAGE)); }
@Test public void create_noShape() { CaseManagementShapeCommand.create(new Object(), shapeView, shapeDef); verify(shapeDef, never()).fontHandler(); verify(shapeView, never()).setTitlePosition(any(HasTitle.VerticalAlignment.class), any(HasTitle.HorizontalAlignment.class), any(HasTitle.ReferencePosition.class), any(HasTitle.Orientation.class)); verify(shapeView, never()).setTextSizeConstraints(any(HasTitle.Size.class)); } |
### Question:
CaseManagementShapeView extends SVGShapeViewImpl implements HasSize<SVGShapeViewImpl> { public int getIndex(final WiresShape shape) { final NFastArrayList<WiresShape> children = getChildShapes(); for (int i = 0, n = children.size(); i < n; i++) { final WiresShape child = children.get(i); if (child == shape || isUUIDSame(shape, child)) { return i; } } return -1; } CaseManagementShapeView(final String name,
final SVGPrimitiveShape svgPrimitive,
final double width,
final double height,
final boolean resizable); CaseManagementShapeView(final String name,
final SVGPrimitiveShape svgPrimitive,
final double width,
final double height,
final boolean resizable,
final Optional<MultiPath> optDropZone); void setLabel(String shapeLabel); double getWidth(); double getHeight(); void logicallyReplace(final CaseManagementShapeView original, final CaseManagementShapeView replacement); void addShape(final WiresShape shape, final int targetIndex); int getIndex(final WiresShape shape); Optional<MultiPath> getDropZone(); CaseManagementShapeView getGhost(); void setCanvas(CaseManagementCanvas canvas); }### Answer:
@Test public void testGetIndex() throws Exception { final CaseManagementShapeView child1 = createShapeView("child1"); final CaseManagementShapeView child2 = createShapeView("child2"); shape.add(child1); shape.add(child2); assertEquals(shape.getIndex(child1), 0); assertEquals(shape.getIndex(child2), 1); } |
### Question:
CaseManagementShapeView extends SVGShapeViewImpl implements HasSize<SVGShapeViewImpl> { public CaseManagementShapeView getGhost() { final CaseManagementShapeView ghost = createGhost(); if (null != ghost) { ghost.setFillColor(ColorName.GRAY.getColorString()); ghost.setFillAlpha(0.5d); ghost.setStrokeAlpha(0.5d); ghost.setUUID(getUUID()); } return ghost; } CaseManagementShapeView(final String name,
final SVGPrimitiveShape svgPrimitive,
final double width,
final double height,
final boolean resizable); CaseManagementShapeView(final String name,
final SVGPrimitiveShape svgPrimitive,
final double width,
final double height,
final boolean resizable,
final Optional<MultiPath> optDropZone); void setLabel(String shapeLabel); double getWidth(); double getHeight(); void logicallyReplace(final CaseManagementShapeView original, final CaseManagementShapeView replacement); void addShape(final WiresShape shape, final int targetIndex); int getIndex(final WiresShape shape); Optional<MultiPath> getDropZone(); CaseManagementShapeView getGhost(); void setCanvas(CaseManagementCanvas canvas); }### Answer:
@Test public void testGetGhost() throws Exception { final CaseManagementShapeView child = createShapeView("child"); shape.add(child); final CaseManagementShapeView ghost = shape.getGhost(); assertTrue(ILayoutHandler.NONE.equals(ghost.getLayoutHandler())); assertEquals(ghost.getUUID(), shape.getUUID()); assertTrue(ghost.getChildShapes().size() == 1); CaseManagementShapeView ghostChild = (CaseManagementShapeView) ghost.getChildShapes().toList().get(0); assertEquals(ghostChild.getUUID(), child.getUUID()); } |
### Question:
CaseManagementStageShapeView extends CaseManagementShapeView { @Override public Optional<MultiPath> getDropZone() { this.getCanvas() .ifPresent(c -> c.getPanelBounds(). ifPresent(b -> this.createDropZone(b.getHeight()))); return super.getDropZone(); } CaseManagementStageShapeView(String name,
SVGPrimitiveShape svgPrimitive,
double width,
double height,
boolean resizable); @Override Optional<MultiPath> getDropZone(); }### Answer:
@Test public void testMakeDropZone() throws Exception { Optional<MultiPath> dropZone = tested.getDropZone(); assertTrue(dropZone.isPresent()); }
@Test public void testGetDropZone() throws Exception { Optional<MultiPath> dropZone1 = tested.getDropZone(); when(canvas.getPanelBounds()).thenReturn(Optional.of(Bounds.build(0.0, 0.0, 0.0, 9999.0))); Optional<MultiPath> dropZone2 = tested.getDropZone(); assertNotEquals(dropZone1, dropZone2); } |
### Question:
CaseManagementDiagramShapeView extends CaseManagementShapeView { @Override public Optional<MultiPath> getDropZone() { this.getCanvas() .ifPresent(c -> c.getPanelBounds(). ifPresent(this::createDropZone)); return super.getDropZone(); } CaseManagementDiagramShapeView(String name,
SVGPrimitiveShape svgPrimitive,
double width,
double height,
boolean resizable); @Override Optional<MultiPath> getDropZone(); }### Answer:
@Test public void testGetDropZone() throws Exception { Optional<MultiPath> dropZone1 = tested.getDropZone(); assertTrue(dropZone1.isPresent()); when(canvas.getPanelBounds()).thenReturn(Optional.of(Bounds.build(0.0, 0.0, 2000.0, 1000.0))); Optional<MultiPath> dropZone2 = tested.getDropZone(); assertTrue(dropZone2.isPresent()); assertNotEquals(dropZone1, dropZone2); } |
### Question:
CaseManagementSvgUserTaskShapeDef extends BaseDimensionedShapeDef implements CaseManagementSvgShapeDef<UserTask> { @Override public SVGShapeView<?> newViewInstance(final CaseManagementSVGViewFactory factory, final UserTask obj) { return newViewInstance(Optional.empty(), Optional.empty(), factory.task()); } @Override SizeHandler<UserTask, SVGShapeView> newSizeHandler(); @Override @SuppressWarnings("unchecked") BiConsumer<UserTask, SVGShapeView> viewHandler(); @Override SVGShapeView<?> newViewInstance(final CaseManagementSVGViewFactory factory, final UserTask obj); @Override FontHandler<UserTask, SVGShapeView> newFontHandler(); @Override Glyph getGlyph(final Class<? extends UserTask> type,
final String defId); }### Answer:
@Test public void testNewViewInstance() throws Exception { tested.newViewInstance(factory, new UserTask()); verify(factory, times(1)).task(); } |
### Question:
CaseManagementSvgUserTaskShapeDef extends BaseDimensionedShapeDef implements CaseManagementSvgShapeDef<UserTask> { @Override public Glyph getGlyph(final Class<? extends UserTask> type, final String defId) { return CaseManagementSVGGlyphFactory.TASK_GLYPH; } @Override SizeHandler<UserTask, SVGShapeView> newSizeHandler(); @Override @SuppressWarnings("unchecked") BiConsumer<UserTask, SVGShapeView> viewHandler(); @Override SVGShapeView<?> newViewInstance(final CaseManagementSVGViewFactory factory, final UserTask obj); @Override FontHandler<UserTask, SVGShapeView> newFontHandler(); @Override Glyph getGlyph(final Class<? extends UserTask> type,
final String defId); }### Answer:
@Test public void testGetGlyph() throws Exception { Glyph glyph = tested.getGlyph(UserTask.class, ""); assertEquals(CaseManagementSVGGlyphFactory.TASK_GLYPH, glyph); } |
### Question:
CaseManagementSvgStageShapeDef extends BaseDimensionedShapeDef implements CaseManagementSvgShapeDef<AdHocSubprocess> { @Override public SVGShapeView<?> newViewInstance(final CaseManagementSVGViewFactory factory, final AdHocSubprocess bean) { return newViewInstance(Optional.empty(), Optional.empty(), factory.stage()); } @Override SizeHandler<AdHocSubprocess, SVGShapeView> newSizeHandler(); @Override SVGShapeView<?> newViewInstance(final CaseManagementSVGViewFactory factory, final AdHocSubprocess bean); @Override Glyph getGlyph(final Class<? extends AdHocSubprocess> type,
final String defId); }### Answer:
@Test public void testNewViewInstance() throws Exception { tested.newViewInstance(factory, new AdHocSubprocess()); verify(factory, times(1)).stage(); }
@Test public void testNewViewInstance_zeroDimension() throws Exception { final Width width = new Width(0.0); final Height height = new Height(0.0); final RectangleDimensionsSet dimensionsSet = new RectangleDimensionsSet(); dimensionsSet.setWidth(width); dimensionsSet.setHeight(height); final AdHocSubprocess adHocSubprocess = new AdHocSubprocess(); adHocSubprocess.setDimensionsSet(dimensionsSet); tested.newViewInstance(factory, new AdHocSubprocess()); verify(factory, times(1)).stage(); } |
### Question:
CaseManagementSvgStageShapeDef extends BaseDimensionedShapeDef implements CaseManagementSvgShapeDef<AdHocSubprocess> { @Override public Glyph getGlyph(final Class<? extends AdHocSubprocess> type, final String defId) { return CaseManagementSVGGlyphFactory.STAGE_GLYPH; } @Override SizeHandler<AdHocSubprocess, SVGShapeView> newSizeHandler(); @Override SVGShapeView<?> newViewInstance(final CaseManagementSVGViewFactory factory, final AdHocSubprocess bean); @Override Glyph getGlyph(final Class<? extends AdHocSubprocess> type,
final String defId); }### Answer:
@Test public void testGetGlyph() throws Exception { Glyph glyph = tested.getGlyph(AdHocSubprocess.class, ""); assertEquals(CaseManagementSVGGlyphFactory.STAGE_GLYPH, glyph); } |
### Question:
CaseManagementSvgDiagramShapeDef extends BaseDimensionedShapeDef implements CaseManagementSvgShapeDef<CaseManagementDiagram> { @Override public SVGShapeView<?> newViewInstance(final CaseManagementSVGViewFactory factory, final CaseManagementDiagram diagram) { return newViewInstance(Optional.of(new Width(0d)), Optional.of(new Height(0d)), factory.rectangle()); } @Override SizeHandler<CaseManagementDiagram, SVGShapeView> newSizeHandler(); @Override SVGShapeView<?> newViewInstance(final CaseManagementSVGViewFactory factory,
final CaseManagementDiagram diagram); }### Answer:
@Test public void testNewViewInstance() throws Exception { tested.newViewInstance(factory, new CaseManagementDiagram()); verify(factory, times(1)).rectangle(); } |
### Question:
CaseManagementSvgSubprocessShapeDef extends BaseDimensionedShapeDef implements CaseManagementSvgShapeDef<ReusableSubprocess> { @Override public SVGShapeView<?> newViewInstance(final CaseManagementSVGViewFactory factory, final ReusableSubprocess bean) { return newViewInstance(Optional.empty(), Optional.empty(), VIEW_RESOURCES.getResource(factory, bean)); } @Override SizeHandler<ReusableSubprocess, SVGShapeView> newSizeHandler(); @Override FontHandler<ReusableSubprocess, SVGShapeView> newFontHandler(); @Override @SuppressWarnings("unchecked") BiConsumer<ReusableSubprocess, SVGShapeView> viewHandler(); @Override SVGShapeView<?> newViewInstance(final CaseManagementSVGViewFactory factory, final ReusableSubprocess bean); @Override Glyph getGlyph(final Class<? extends ReusableSubprocess> type,
final String defId); static final SVGShapeViewResources<ReusableSubprocess, CaseManagementSVGViewFactory> VIEW_RESOURCES; static final Map<Class<? extends ReusableSubprocess>, Glyph> GLYPHS; }### Answer:
@Test public void testNewViewInstance() throws Exception { tested.newViewInstance(factory, new CaseReusableSubprocess()); verify(factory, times(1)).subcase(); tested.newViewInstance(factory, new ProcessReusableSubprocess()); verify(factory, times(1)).subprocess(); } |
### Question:
CaseManagementSvgSubprocessShapeDef extends BaseDimensionedShapeDef implements CaseManagementSvgShapeDef<ReusableSubprocess> { @Override public Glyph getGlyph(final Class<? extends ReusableSubprocess> type, final String defId) { return GLYPHS.get(type); } @Override SizeHandler<ReusableSubprocess, SVGShapeView> newSizeHandler(); @Override FontHandler<ReusableSubprocess, SVGShapeView> newFontHandler(); @Override @SuppressWarnings("unchecked") BiConsumer<ReusableSubprocess, SVGShapeView> viewHandler(); @Override SVGShapeView<?> newViewInstance(final CaseManagementSVGViewFactory factory, final ReusableSubprocess bean); @Override Glyph getGlyph(final Class<? extends ReusableSubprocess> type,
final String defId); static final SVGShapeViewResources<ReusableSubprocess, CaseManagementSVGViewFactory> VIEW_RESOURCES; static final Map<Class<? extends ReusableSubprocess>, Glyph> GLYPHS; }### Answer:
@Test public void testGetGlyph() throws Exception { Glyph subcaseGlyph = tested.getGlyph(CaseReusableSubprocess.class, ""); assertEquals(CaseManagementSVGGlyphFactory.SUBCASE_GLYPH, subcaseGlyph); Glyph subprocessGlyph = tested.getGlyph(ProcessReusableSubprocess.class, ""); assertEquals(CaseManagementSVGGlyphFactory.SUBPROCESS_GLYPH, subprocessGlyph); } |
### Question:
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph) { return GraphUtils.getFirstNode(graph, CaseManagementDiagram.class); } @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent); }### Answer:
@Test public void checkGetFirstDiagramNodeWithEmptyGraph() { final Graph graph = new GraphImpl<>("uuid", new GraphNodeStoreImpl()); final Node<Definition<CaseManagementDiagram>, ?> fNode = CaseManagementCommandUtil.getFirstDiagramNode(graph); assertNull(fNode); }
@Test @SuppressWarnings("unchecked") public void checkGetFirstDiagramNodeWithNonEmptyGraph() { final Graph graph = new GraphImpl<>("uuid", new GraphNodeStoreImpl()); final Node node = new NodeImpl<Definition>("node-uuid"); final CaseManagementDiagram content = new CaseManagementDiagram(); node.setContent(new DefinitionImpl<>(content)); graph.addNode(node); final Node<Definition<CaseManagementDiagram>, ?> fNode = CaseManagementCommandUtil.getFirstDiagramNode(graph); assertNotNull(fNode); assertEquals("node-uuid", fNode.getUUID()); assertEquals(content, fNode.getContent().getDefinition()); } |
### Question:
PMMLIncludedDocumentFactory { public PMMLDocumentMetadata getDocumentByPath(final Path path) { return Optional.ofNullable(loadPMMLInfo(path)).map(pmml -> convertPMMLInfo(path, pmml)).orElse(emptyPMMLDocumentMetadata(path)); } PMMLIncludedDocumentFactory(); @Inject PMMLIncludedDocumentFactory(final @Named("ioStrategy") IOService ioService); PMMLDocumentMetadata getDocumentByPath(final Path path); PMMLDocumentMetadata getDocumentByPath(final Path path,
final PMMLIncludedModel includeModel); }### Answer:
@Test public void testGetDocumentByPathWithUnknownPath() { final Path path = mock(Path.class); when(path.toURI()).thenReturn(URI); when(ioService.newInputStream(any())).thenThrow(new NoSuchFileException()); final PMMLDocumentMetadata document = factory.getDocumentByPath(path); assertThat(document).isNotNull(); assertThat(document.getPath()).isEqualTo(URI); assertThat(document.getImportType()).isEqualTo(NAMESPACE); assertThat(document.getModels()).isEmpty(); }
@Test public void testGetDocumentByPathWithUnknownPathWithIncludedModel() { final Path path = mock(Path.class); final PMMLIncludedModel includedModel = makePMMLIncludedModel(); when(path.toURI()).thenReturn(URI); when(ioService.newInputStream(any())).thenThrow(new NoSuchFileException()); final PMMLDocumentMetadata document = factory.getDocumentByPath(path, includedModel); assertThat(document).isNotNull(); assertThat(document.getPath()).isEqualTo(URI); assertThat(document.getImportType()).isEqualTo(NAMESPACE); assertThat(document.getName()).isEqualTo(DOCUMENT_NAME); assertThat(document.getModels()).isEmpty(); } |
### Question:
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static int getChildGraphIndex(final Node parent, final Node child) { if (parent != null && child != null) { List<Edge> outEdges = parent.getOutEdges(); if (null != outEdges && !outEdges.isEmpty()) { for (int i = 0, n = outEdges.size(); i < n; i++) { if (child.equals(outEdges.get(i).getTargetNode())) { return i; } } } } return -1; } @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent); }### Answer:
@Test public void testGetGraphIndex() { final Edge edge = mock(Edge.class); when(edge.getTargetNode()).thenReturn(child); when(parent.getOutEdges()).thenReturn(Collections.singletonList(edge)); assertEquals(0, CaseManagementCommandUtil.getChildGraphIndex(parent, child)); } |
### Question:
CaseManagementCommandUtil { public static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child) { return !Objects.isNull(parent.getContent()) && parent.getContent().getDefinition() instanceof CaseManagementDiagram && isStageNode(child); } @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent); }### Answer:
@Test public void testIsStage_withStage() { setupForStage(); assertTrue(CaseManagementCommandUtil.isStage(parent, child)); }
@Test public void testIsStage_withSubStage() { setupForSubStage(); assertFalse(CaseManagementCommandUtil.isStage(parent, child)); } |
### Question:
CaseManagementCommandUtil { public static boolean isStageNode(final Node<View<?>, Edge> node) { if (node.getContent().getDefinition() instanceof AdHocSubprocess) { final List<Node> childNodes = node.getOutEdges().stream() .filter(childPredicate()) .map(Edge::getTargetNode).collect(Collectors.toList()); return childNodes.isEmpty() || childNodes.stream().allMatch(CaseManagementCommandUtil::isSubStageNode); } return false; } @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent); }### Answer:
@Test public void testIsStageNode() { setupForStage(); assertTrue(CaseManagementCommandUtil.isStageNode(child)); } |
### Question:
CaseManagementCommandUtil { public static boolean isSubStageNode(final Node<View<?>, Edge> node) { return node.getContent().getDefinition() instanceof UserTask || node.getContent().getDefinition() instanceof ReusableSubprocess; } @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent); }### Answer:
@Test public void testIsSubStageNode() { setupForSubStage(); assertTrue(CaseManagementCommandUtil.isSubStageNode(child)); } |
### Question:
CaseManagementCommandUtil { public static Predicate<Edge> childPredicate() { return edge -> edge.getContent() instanceof Child; } @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent); }### Answer:
@Test public void testChildPredicate() { final Predicate<Edge> predicate = CaseManagementCommandUtil.childPredicate(); final Edge edge = mock(Edge.class); when(edge.getContent()).thenReturn(mock(Child.class)); assertTrue(predicate.test(edge)); } |
### Question:
CaseManagementCommandUtil { public static Predicate<Edge> sequencePredicate() { return edge -> edge.getContent() instanceof ViewConnector && ((ViewConnector) edge.getContent()).getDefinition() instanceof SequenceFlow; } @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent); }### Answer:
@Test public void testSequencePredicate() { final Predicate<Edge> predicate = CaseManagementCommandUtil.sequencePredicate(); final Edge edge = mock(Edge.class); final ViewConnector viewConnector = mock(ViewConnector.class); when(viewConnector.getDefinition()).thenReturn(mock(SequenceFlow.class)); when(edge.getContent()).thenReturn(viewConnector); assertTrue(predicate.test(edge)); } |
### Question:
LazyCanvasFocusUtils { public void releaseFocus() { getFocusedNodeUUID().ifPresent(canvasFocusUtils::focus); releaseNodeUUID(); } LazyCanvasFocusUtils(); @Inject LazyCanvasFocusUtils(final CanvasFocusUtils canvasFocusUtils); void lazyFocus(final String nodeUUID); void releaseFocus(); }### Answer:
@Test public void testFocusWhenLazyLoadIsEmpty() { utils.releaseFocus(); verify(canvasFocusUtils, never()).focus(anyString()); } |
### Question:
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent) { Predicate<Node> predicate = Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram) ? CaseManagementCommandUtil::isSubStageNode : CaseManagementCommandUtil::isStageNode; return (int) parent.getOutEdges().stream() .filter(childPredicate()) .filter(edge -> predicate.test(edge.getTargetNode())).count(); } @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent); }### Answer:
@Test public void testGetCanvasNewChildIndex_withStage() { setupForStage(); assertEquals(2, CaseManagementCommandUtil.getNewChildCanvasIndex(parent)); }
@Test public void testGetCanvasNewChildIndex_withSubStage() { setupForSubStage(); assertEquals(2, CaseManagementCommandUtil.getNewChildCanvasIndex(parent)); } |
### Question:
CaseManagementCommandUtil { @SuppressWarnings("unchecked") public static int getNewChildGraphIndex(final Node<View<?>, Edge> parent) { if (Objects.isNull(parent.getContent()) || !(parent.getContent().getDefinition() instanceof CaseManagementDiagram)) { return parent.getOutEdges().size(); } List<Node<View<?>, Edge>> childNodes = parent.getOutEdges().stream() .map(edge -> (Node<View<?>, Edge>) edge.getTargetNode()) .collect(Collectors.toList()); for (int n = childNodes.size(), i = n - 1; i >= 0; i--) { Node<View<?>, Edge> node = childNodes.get(i); if (isStageNode(node) || node.getContent().getDefinition() instanceof StartNoneEvent) { return i + 1; } } return 0; } @SuppressWarnings("unchecked") static Node<Definition<CaseManagementDiagram>, ?> getFirstDiagramNode(final Graph<?, Node> graph); @SuppressWarnings("unchecked") static int getChildGraphIndex(final Node parent,
final Node child); @SuppressWarnings("unchecked") static int getChildCanvasIndex(final Node<View<?>, Edge> parent,
final Node<View<?>, Edge> child); static boolean isStage(final Node<View<?>, Edge> parent, final Node<View<?>, Edge> child); static boolean isStageNode(final Node<View<?>, Edge> node); static boolean isSubStageNode(final Node<View<?>, Edge> node); static Predicate<Edge> childPredicate(); static Predicate<Edge> sequencePredicate(); @SuppressWarnings("unchecked") static int getNewChildCanvasIndex(final Node<View<?>, Edge> parent); @SuppressWarnings("unchecked") static int getNewChildGraphIndex(final Node<View<?>, Edge> parent); }### Answer:
@Test public void testGetGraphNewChildIndex_withStage() { setupForStage(); assertEquals(2, CaseManagementCommandUtil.getNewChildGraphIndex(parent)); }
@Test public void testGetGraphNewChildIndex_withSubStage() { setupForSubStage(); assertEquals(2, CaseManagementCommandUtil.getNewChildGraphIndex(parent)); } |
### Question:
CaseManagementClearCommand extends ClearCommand { @Override @SuppressWarnings("unchecked") public CommandResult<CanvasViolation> execute(AbstractCanvasHandler context) { final String rootUUID = context.getDiagram().getMetadata().getCanvasRootUUID(); final Shape rootShape = context.getCanvas().getShape(rootUUID); final CommandResult<CanvasViolation> result = super.execute(context); final Node<View, Edge> node = context.getGraphIndex().getNode(rootUUID); context.deregister(rootShape, node, true); context.register(context.getDiagram().getMetadata().getShapeSetId(), node); return result; } @Override @SuppressWarnings("unchecked") CommandResult<CanvasViolation> execute(AbstractCanvasHandler context); }### Answer:
@Test public void testExecute() throws Exception { tested.execute(canvasHandler); verify(canvasHandler, times(1)).deregister(eq(rootShape), eq(rootNode), eq(true)); verify(canvasHandler, times(1)).register(eq(SHAPE_SET_ID), eq(rootNode)); } |
### Question:
CaseManagementAddNodeCommand extends AddNodeCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(AbstractCanvasHandler context) { return new org.kie.workbench.common.stunner.cm.client.command.graph.CaseManagementAddNodeCommand(getCandidate()); } CaseManagementAddNodeCommand(Node candidate, String shapeSetId); }### Answer:
@Test public void testNewGraphCommand() { final Command<GraphCommandExecutionContext, RuleViolation> command = tested.newGraphCommand(canvasHandler); assertNotNull(command); assertTrue(command instanceof org.kie.workbench.common.stunner.cm.client.command.graph.CaseManagementAddNodeCommand); assertEquals(candidate, ((org.kie.workbench.common.stunner.cm.client.command.graph.CaseManagementAddNodeCommand) command).getCandidate()); } |
### Question:
CanvasFocusUtils { public void focus(final String nodeUUID) { final CanvasHandler canvasHandler = dmnGraphUtils.getCanvasHandler(); canvasSelectionEvent.fire(makeCanvasSelectionEvent(canvasHandler, nodeUUID)); canvasFocusedSelectionEvent.fire(makeCanvasFocusedShapeEvent(canvasHandler, nodeUUID)); if (canvasHandler != null && canvasHandler.getCanvas() != null) { canvasHandler.getCanvas().focus(); } } @Inject CanvasFocusUtils(final DMNGraphUtils dmnGraphUtils,
final Event<CanvasFocusedShapeEvent> canvasFocusedSelectionEvent,
final Event<CanvasSelectionEvent> canvasSelectionEvent); void focus(final String nodeUUID); }### Answer:
@Test public void testFocus() { final CanvasHandler canvasHandler = mock(CanvasHandler.class); final Canvas canvas = mock(Canvas.class); final String uuid = "uuid"; final CanvasSelectionEvent canvasSelection = new CanvasSelectionEvent(canvasHandler, uuid); final CanvasFocusedShapeEvent canvasFocusedShape = new CanvasFocusedShapeEvent(canvasHandler, uuid); when(dmnGraphUtils.getCanvasHandler()).thenReturn(canvasHandler); doReturn(canvasSelection).when(canvasFocusUtils).makeCanvasSelectionEvent(canvasHandler, uuid); doReturn(canvasFocusedShape).when(canvasFocusUtils).makeCanvasFocusedShapeEvent(canvasHandler, uuid); doReturn(canvas).when(canvasHandler).getCanvas(); canvasFocusUtils.focus(uuid); verify(canvasSelectionEvent).fire(canvasSelection); verify(canvasFocusedSelectionEvent).fire(canvasFocusedShape); verify(canvas).focus(); } |
### Question:
DecisionNavigatorTreePresenter { @PostConstruct void setup() { view.init(this); } @Inject DecisionNavigatorTreePresenter(final View view); View getView(); void setupItems(final List<DecisionNavigatorItem> items); void removeAllItems(); DecisionNavigatorItem getActiveParent(); void setActiveParentUUID(final String activeParentUUID); void selectItem(final String uuid); void deselectItem(); }### Answer:
@Test public void testSetup() { presenter.setup(); verify(view).init(presenter); } |
### Question:
CaseManagementSetChildNodeGraphCommand extends AbstractGraphCommand { Supplier<ViewConnector<SequenceFlow>> sequenceFlowSupplier() { ViewConnector<SequenceFlow> viewConnector = new ViewConnectorImpl<>(new SequenceFlow(), Bounds.create(0d, 0d, 30d, 30d)); viewConnector.setSourceConnection(new MagnetConnection.Builder().atX(475d).atY(475d).auto(true).build()); viewConnector.setTargetConnection(new MagnetConnection.Builder().atX(475d).atY(475d).auto(true).build()); return () -> viewConnector; } CaseManagementSetChildNodeGraphCommand(final Node<View<?>, Edge> parent,
final Node<View<?>, Edge> child,
final OptionalInt index,
final Optional<Node<View<?>, Edge>> originalParent,
final OptionalInt originalIndex); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); OptionalInt getIndex(); OptionalInt getOriginalIndex(); }### Answer:
@Test public void testSequenceFlowSupplier() { final CaseManagementSetChildNodeGraphCommand command = new CaseManagementSetChildNodeGraphCommand(parent, candidate, index, originalParent, originalIndex); final Supplier<ViewConnector<SequenceFlow>> supplier = command.sequenceFlowSupplier(); final ViewConnector<SequenceFlow> viewConnector = supplier.get(); assertNotNull(viewConnector); assertNotNull(viewConnector.getSourceConnection()); assertNotNull(viewConnector.getTargetConnection()); assertNotNull(viewConnector.getBounds()); assertNotNull(viewConnector.getDefinition()); } |
### Question:
CaseManagementSafeDeleteNodeCommand extends SafeDeleteNodeCommand { @Override @SuppressWarnings("unchecked") protected CaseManagementRemoveChildCommand createRemoveChildCommand(final Element<?> parent, final Node<?, Edge> candidate) { return new CaseManagementRemoveChildCommand((Node<View<?>, Edge>) parent, (Node<View<?>, Edge>) candidate); } CaseManagementSafeDeleteNodeCommand(@MapsTo("candidateUUID") String candidateUUID,
@MapsTo("options") Options options); CaseManagementSafeDeleteNodeCommand(Node<?, Edge> node); CaseManagementSafeDeleteNodeCommand(Node<?, Edge> node, Options options); CaseManagementSafeDeleteNodeCommand(Node<?, Edge> node,
SafeDeleteNodeCommandCallback safeDeleteCallback,
Options options); }### Answer:
@Test @SuppressWarnings("unchecked") public void testCreateRemoveChildCommand() { final CaseManagementRemoveChildCommand command = tested.createRemoveChildCommand(parent, candidate); assertEquals(parent, command.getParent()); assertEquals(candidate, command.getCandidate()); } |
### Question:
CaseManagementRemoveChildCommand extends RemoveChildrenCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(GraphCommandExecutionContext context) { final Node<View<?>, Edge> parent = (Node<View<?>, Edge>) getParent(context); final Node<View<?>, Edge> candidate = (Node<View<?>, Edge>) getCandidate(context); final CaseManagementSetChildNodeGraphCommand undoCommand = new CaseManagementSetChildNodeGraphCommand(parent, candidate, OptionalInt.of(index), Optional.empty(), OptionalInt.empty()); return undoCommand.execute(context); } CaseManagementRemoveChildCommand(@MapsTo("parentUUID") String parentUUID,
@MapsTo("candidateUUID") String candidateUUID); CaseManagementRemoveChildCommand(Node<View<?>, Edge> parent,
Node<View<?>, Edge> candidate); Node<?, Edge> getCandidate(); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(GraphCommandExecutionContext context); }### Answer:
@Test public void testUndo() { parent.getOutEdges().clear(); tested.undo(context); assertEquals(1, parent.getOutEdges().size()); assertEquals(1, candidate.getInEdges().size()); assertEquals(parent.getOutEdges().get(0), candidate.getInEdges().get(0)); final Edge edge = parent.getOutEdges().get(0); assertEquals(parent, edge.getSourceNode()); assertEquals(candidate, edge.getTargetNode()); assertTrue(edge.getContent() instanceof Child); } |
### Question:
CaseManagementDeleteElementsCommand extends DeleteElementsCommand { @Override protected CaseManagementSafeDeleteNodeCommand createSafeDeleteNodeCommand(final Node<?, Edge> node, final SafeDeleteNodeCommand.Options options, final DeleteCallback callback) { return new CaseManagementSafeDeleteNodeCommand(node, callback.onDeleteNode(node, options), options); } CaseManagementDeleteElementsCommand(@MapsTo("uuids") Collection<String> uuids); CaseManagementDeleteElementsCommand(Supplier<Collection<Element>> elements); CaseManagementDeleteElementsCommand(Supplier<Collection<Element>> elements,
DeleteCallback callback); }### Answer:
@Test @SuppressWarnings("unchecked") public void testCreateSafeDeleteNodeCommand() { final CaseManagementSafeDeleteNodeCommand command = tested.createSafeDeleteNodeCommand(node, SafeDeleteNodeCommand.Options.defaults(), new DeleteElementsCommand.DeleteCallback() { }); assertEquals(node, command.getNode()); } |
### Question:
CaseManagementCloneNodeCommand extends CloneNodeCommand { @Override protected void createNodeCommands(final Node<View, Edge> clone, final String parentUUID, final Point2D position) { addCommand(new RegisterNodeCommand(clone)); addCommand(new CaseManagementAddChildNodeGraphCommand(parentUUID, clone, OptionalInt.empty())); } protected CaseManagementCloneNodeCommand(); CaseManagementCloneNodeCommand(@MapsTo("candidate") Node candidate,
@MapsTo("parentUuid") String parentUuid); CaseManagementCloneNodeCommand(Node candidate,
String parentUuid,
Point2D position,
Consumer<Node> callback,
ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessor); CaseManagementCloneNodeCommand(Node candidate,
String parentUuid,
Point2D position,
Consumer<Node> callback); @Override CommandResult<RuleViolation> undo(GraphCommandExecutionContext context); }### Answer:
@Test public void testCreateNodeCommands() throws Exception { tested.createNodeCommands(graphInstance.containerNode, graphInstance.parentNode.getUUID(), position); assertEquals(2, tested.getCommands().size()); assertTrue(RegisterNodeCommand.class.isInstance(tested.getCommands().get(0))); assertTrue(CaseManagementAddChildNodeGraphCommand.class.isInstance(tested.getCommands().get(1))); } |
### Question:
CaseManagementCloneNodeCommand extends CloneNodeCommand { @Override protected CloneNodeCommand createCloneChildCommand(final Node candidate, final String parentUuid, final Point2D position, final Consumer<Node> callback, final ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessor) { return new CaseManagementCloneNodeCommand(candidate, parentUuid, position, callback, childrenTraverseProcessor); } protected CaseManagementCloneNodeCommand(); CaseManagementCloneNodeCommand(@MapsTo("candidate") Node candidate,
@MapsTo("parentUuid") String parentUuid); CaseManagementCloneNodeCommand(Node candidate,
String parentUuid,
Point2D position,
Consumer<Node> callback,
ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessor); CaseManagementCloneNodeCommand(Node candidate,
String parentUuid,
Point2D position,
Consumer<Node> callback); @Override CommandResult<RuleViolation> undo(GraphCommandExecutionContext context); }### Answer:
@Test public void testCreateCloneChildCommand() throws Exception { final CloneNodeCommand command = tested.createCloneChildCommand(graphInstance.containerNode, graphInstance.parentNode.getUUID(), position, null, childrenTraverseProcessorManagedInstance); assertTrue(CaseManagementCloneNodeCommand.class.isInstance(command)); } |
### Question:
DecisionNavigatorTreePresenter { public void setupItems(final List<DecisionNavigatorItem> items) { getIndexedItems().clear(); index(items); view.clean(); view.setup(items); } @Inject DecisionNavigatorTreePresenter(final View view); View getView(); void setupItems(final List<DecisionNavigatorItem> items); void removeAllItems(); DecisionNavigatorItem getActiveParent(); void setActiveParentUUID(final String activeParentUUID); void selectItem(final String uuid); void deselectItem(); }### Answer:
@Test public void testSetupItems() { final ArrayList<DecisionNavigatorItem> items = new ArrayList<>(); doNothing().when(presenter).index(items); presenter.setupItems(items); verify(presenter).index(items); verify(view).clean(); verify(view).setup(items); } |
### Question:
CaseManagementDeleteNodeCommand extends DeleteNodeCommand { @Override @SuppressWarnings("unchecked") protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(AbstractCanvasHandler context) { return new CaseManagementSafeDeleteNodeCommand(candidate, deleteProcessor, options); } CaseManagementDeleteNodeCommand(Node candidate); CaseManagementDeleteNodeCommand(Node candidate, SafeDeleteNodeCommand.Options options); }### Answer:
@Test public void testNewGraphCommand() { final Command<GraphCommandExecutionContext, RuleViolation> graphCommand = tested.newGraphCommand(canvasHandler); assertNotNull(graphCommand); assertTrue(graphCommand instanceof CaseManagementSafeDeleteNodeCommand); assertEquals(candidate, ((CaseManagementSafeDeleteNodeCommand) graphCommand).getNode()); } |
### Question:
CaseManagementDeleteElementsCommand extends DeleteElementsCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(AbstractCanvasHandler context) { return new org.kie.workbench.common.stunner.cm.client.command.graph.CaseManagementDeleteElementsCommand(this::getElements, new CaseManagementCanvasMultipleDeleteProcessor()); } CaseManagementDeleteElementsCommand(Collection<Element> elements); }### Answer:
@Test public void testNewGraphCommand() { final Command<GraphCommandExecutionContext, RuleViolation> command = tested.newGraphCommand(canvasHandler); assertNotNull(command); assertTrue(command instanceof org.kie.workbench.common.stunner.cm.client.command.graph.CaseManagementDeleteElementsCommand); } |
### Question:
CaseManagementUpdatePositionCommand extends org.kie.workbench.common.stunner.core.client.canvas.command.UpdateElementPositionCommand { @Override @SuppressWarnings("unchecked") protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler context) { return new CaseManagementUpdatePositionGraphCommand(); } CaseManagementUpdatePositionCommand(final Node<View<?>, Edge> element,
final Point2D location); }### Answer:
@Test public void testGraphCommand() { final CaseManagementUpdatePositionGraphCommand graphCommand; graphCommand = (CaseManagementUpdatePositionGraphCommand) command.newGraphCommand(canvasHandler); assertNotNull(graphCommand); assertCommandSuccess(graphCommand.execute(context)); assertPositionNotUpdated(); } |
### Question:
CaseManagementUpdatePositionCommand extends org.kie.workbench.common.stunner.core.client.canvas.command.UpdateElementPositionCommand { @Override protected AbstractCanvasCommand newCanvasCommand(final AbstractCanvasHandler context) { return new CaseManagementUpdatePositionCanvasCommand(); } CaseManagementUpdatePositionCommand(final Node<View<?>, Edge> element,
final Point2D location); }### Answer:
@Test public void testCanvasCommand() { final CaseManagementUpdatePositionCanvasCommand canvasCommand; canvasCommand = (CaseManagementUpdatePositionCanvasCommand) command.newCanvasCommand(canvasHandler); assertNotNull(canvasCommand); assertCommandSuccess(canvasCommand.execute(canvasHandler)); assertPositionNotUpdated(); } |
### Question:
CaseManagementCloneNodeCommand extends CloneNodeCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(AbstractCanvasHandler context) { return new org.kie.workbench.common.stunner.cm.client.command.graph.CaseManagementCloneNodeCommand(getCandidate(), getParentUuid(), getClonePosition(), cloneNodeCallback(context), getChildrenTraverseProcessor()); } CaseManagementCloneNodeCommand(Node candidate,
String parentUuid,
Point2D cloneLocation,
Consumer<Node> cloneNodeCommandCallback,
ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessor); @Override CaseManagementCloneCanvasNodeCommand getCloneCanvasNodeCommand(Node parent, Node clone, String shapeId); }### Answer:
@Test public void testNewGraphCommand() throws Exception { final Command<GraphCommandExecutionContext, RuleViolation> command = tested.newGraphCommand(canvasHandler); assertNotNull(command); assertTrue(command instanceof org.kie.workbench.common.stunner.cm.client.command.graph.CaseManagementCloneNodeCommand); assertEquals(candidate, ((org.kie.workbench.common.stunner.cm.client.command.graph.CaseManagementCloneNodeCommand) command).getCandidate()); } |
### Question:
CaseManagementCloneNodeCommand extends CloneNodeCommand { @Override public CaseManagementCloneCanvasNodeCommand getCloneCanvasNodeCommand(Node parent, Node clone, String shapeId) { return new CaseManagementCloneCanvasNodeCommand(parent, clone, shapeId, getChildrenTraverseProcessor()); } CaseManagementCloneNodeCommand(Node candidate,
String parentUuid,
Point2D cloneLocation,
Consumer<Node> cloneNodeCommandCallback,
ManagedInstance<ChildrenTraverseProcessor> childrenTraverseProcessor); @Override CaseManagementCloneCanvasNodeCommand getCloneCanvasNodeCommand(Node parent, Node clone, String shapeId); }### Answer:
@Test public void testGetCloneCanvasNodeCommand() { final CaseManagementCloneCanvasNodeCommand command = tested.getCloneCanvasNodeCommand(parent, clone, shapeUUID); assertEquals(parent, command.getParent()); assertEquals(clone, command.getCandidate()); assertEquals(shapeUUID, command.getShapeSetId()); } |
### Question:
CaseManagementDeleteCanvasNodeCommand extends DeleteCanvasNodeCommand { @Override protected AbstractCanvasCommand createUndoCommand(Node parent, Node candidate, String ssid) { return new CaseManagementAddChildNodeCanvasCommand(parent, candidate, ssid, index); } CaseManagementDeleteCanvasNodeCommand(Node candidate); CaseManagementDeleteCanvasNodeCommand(Node candidate,
Node parent,
int index); }### Answer:
@Test public void testCreateUndoCommand() { final AbstractCanvasCommand command = this.tested.createUndoCommand(parent, candidate, "ssid"); assertNotNull(command); assertTrue(command instanceof CaseManagementAddChildNodeCanvasCommand); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.