-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FBP-100. Added tests for default flow sequence selector
- Loading branch information
Showing
2 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...-intellij-plugin-core/src/test/kotlin/com/valb3r/bpmn/intellij/plugin/FlowSequenceTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.valb3r.bpmn.intellij.plugin | ||
|
||
import com.nhaarman.mockitokotlin2.any | ||
import com.nhaarman.mockitokotlin2.argumentCaptor | ||
import com.nhaarman.mockitokotlin2.verify | ||
import com.nhaarman.mockitokotlin2.whenever | ||
import com.valb3r.bpmn.intellij.plugin.bpmn.api.events.EventPropagatableToXml | ||
import com.valb3r.bpmn.intellij.plugin.bpmn.api.info.PropertyType | ||
import com.valb3r.bpmn.intellij.plugin.core.events.BooleanValueUpdatedEvent | ||
import com.valb3r.bpmn.intellij.plugin.core.events.StringValueUpdatedEvent | ||
import com.valb3r.bpmn.intellij.plugin.core.newelements.registerNewElementsFactory | ||
import com.valb3r.bpmn.intellij.plugin.core.properties.propertiesVisualizer | ||
import com.valb3r.bpmn.intellij.plugin.core.tests.BaseUiTest | ||
import com.valb3r.bpmn.intellij.plugin.flowable.parser.FlowableObjectFactory | ||
import org.amshove.kluent.* | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
import javax.swing.JCheckBox | ||
import javax.swing.table.DefaultTableModel | ||
|
||
internal class FlowSequenceTest: BaseUiTest() { | ||
|
||
@BeforeEach | ||
fun prepare() { | ||
registerNewElementsFactory(project, FlowableObjectFactory()) | ||
} | ||
|
||
@Test | ||
fun `No Default flow selection on flow sequence element without gateway`() { | ||
prepareOneSubProcessWithServiceTaskAndAttachedBoundaryEventOneNestedSubprocessAndServiceTaskWithSequence() | ||
clickOnId(sequenceFlowDiagramId) | ||
val propertiesVisible = (0 until propertiesTable.model.rowCount).map { propertiesTable.model.getValueAt(it, 0) as String } | ||
propertiesVisible.shouldNotContain(PropertyType.DEFAULT_FLOW_ON_SEQUENCE.caption) | ||
} | ||
|
||
@Test | ||
fun `Default flow selection present on flow sequence element with gateway`() { | ||
prepareExclusiveGatewayAttachedToServiceTaskWithFlowSequence() | ||
clickOnId(sequenceFlowDiagramId) | ||
|
||
val propertiesVisible = (0 until propertiesTable.model.rowCount).map { propertiesTable.model.getValueAt(it, 0) as String } | ||
propertiesVisible.shouldContain(PropertyType.DEFAULT_FLOW_ON_SEQUENCE.caption) | ||
|
||
whenever(boolFieldsConstructed[Pair(sequenceFlowBpmnId, PropertyType.DEFAULT_FLOW_ON_SEQUENCE)]!!.isSelected).thenReturn(true) | ||
propertiesVisualizer(project).clear() | ||
|
||
argumentCaptor<List<EventPropagatableToXml>>().apply { | ||
verify(fileCommitter).executeCommitAndGetHash(any(), capture(), any(), any()) | ||
firstValue.shouldHaveSize(2) | ||
val xmlOnlyUpdate = firstValue.filterIsInstance<StringValueUpdatedEvent>().shouldHaveSingleItem() | ||
val uiOnlyUpdate = firstValue.filterIsInstance<BooleanValueUpdatedEvent>().shouldHaveSingleItem() | ||
xmlOnlyUpdate.bpmnElementId.shouldBeEqualTo(exclusiveGatewayBpmnId) | ||
xmlOnlyUpdate.property.shouldBeEqualTo(PropertyType.DEFAULT_FLOW) | ||
uiOnlyUpdate.bpmnElementId.shouldBeEqualTo(sequenceFlowBpmnId) | ||
uiOnlyUpdate.property.shouldBeEqualTo(PropertyType.DEFAULT_FLOW_ON_SEQUENCE) | ||
} | ||
|
||
} | ||
} |