Skip to content

Commit

Permalink
Some additional testing
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-ka committed Aug 13, 2024
1 parent 6db60d4 commit cce5d2f
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

Stakeholders {
StakeholderGroup Customers_and_Shoppers {
Stakeholder Shoppers_in_Emergency_Situations
Stakeholder Others
}
StakeholderGroup Delivery_Staff_of_Suppliers
}

ValueRegister SD_Values {

ValueCluster Autonomy {
core AUTONOMY
demonstrator "customer values potentially increased freedom"
demonstrator "delivery staff's freedom might suffer because of work-life-balance"

Value Freedom {
Stakeholder Customers_and_Shoppers {
priority HIGH
impact MEDIUM
consequences
good "increased freedom"
}

Stakeholder Delivery_Staff_of_Suppliers {
priority HIGH
impact HIGH
consequences
bad "work-life-balance"
good "tbd"

}

}
Value Sustainability {
Stakeholder Customers_and_Shoppers {
priority HIGH
impact LOW
consequences
bad "fostering unsustainable behavior (always ordering last minute)"
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void prepare() {
}

@Test
public void canCreateStakeholderDiagramWithoutBoundedContext() throws IOException {
public void canCreateValueImpactMapDiagramDiagramWithoutBoundedContext() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("value-impact-map-diagram-generation-test-2.cml").getContextMappingModel();

Expand Down Expand Up @@ -69,7 +69,7 @@ public void canCreateStakeholderDiagramWithoutBoundedContext() throws IOExceptio
}

@Test
public void canCreateSimpleStakeholderDiagram() throws IOException {
public void canCreateSimpleValueImpactMapDiagram() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("value-impact-map-diagram-generation-test-3.cml").getContextMappingModel();

Expand Down Expand Up @@ -110,7 +110,7 @@ public void canCreateSimpleStakeholderDiagram() throws IOException {
}

@Test
public void canCreateSimpleStakeholderDiagram4ValueCluster() throws IOException {
public void canCreateSimpleValueImpactMapDiagram4ValueCluster() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("value-impact-map-diagram-generation-test-4.cml").getContextMappingModel();

Expand Down Expand Up @@ -203,6 +203,66 @@ public void canRespectValuesInValueClusters() throws IOException {
+ "@endmindmap" + System.lineSeparator(), valueImpactMapDiagram);
}

@Test
public void canHandleRecurringStakeholders() throws IOException {
// given
ContextMappingModel model = getOriginalResourceOfTestCML("value-impact-map-diagram-generation-test-6.cml").getContextMappingModel();

// when
String valueImpactMapDiagram = new PlantUMLValueImpactMapGenerator().createDiagram(model.getValueRegisters().get(0));

// then
assertEquals("@startmindmap" + System.lineSeparator()
+ System.lineSeparator()
+ "<style>" + System.lineSeparator()
+ "node {" + System.lineSeparator()
+ " MinimumWidth 200" + System.lineSeparator()
+ " MaximumWidth 200" + System.lineSeparator()
+ "}" + System.lineSeparator()
+ "mindmapDiagram {" + System.lineSeparator()
+ " .green {" + System.lineSeparator()
+ " BackgroundColor lightgreen" + System.lineSeparator()
+ " }" + System.lineSeparator()
+ " .red {" + System.lineSeparator()
+ " BackgroundColor tomato" + System.lineSeparator()
+ " }" + System.lineSeparator()
+ "}" + System.lineSeparator()
+ "</style>" + System.lineSeparator()
+ System.lineSeparator()
+ "* System of Interest (SOI)" + System.lineSeparator()
+ "** Delivery_Staff_of_Suppliers" + System.lineSeparator()
+ "***:<b>Freedom" + System.lineSeparator()
+ "----" + System.lineSeparator()
+ "Priority HIGH" + System.lineSeparator()
+ "Impact HIGH" + System.lineSeparator()
+ "-- Consequence --" + System.lineSeparator()
+ "work-life-balance" + System.lineSeparator()
+ "; <<red>>" + System.lineSeparator()
+ "***:<b>Freedom" + System.lineSeparator()
+ "----" + System.lineSeparator()
+ "Priority HIGH" + System.lineSeparator()
+ "Impact HIGH" + System.lineSeparator()
+ "-- Consequence --" + System.lineSeparator()
+ "tbd" + System.lineSeparator()
+ "; <<green>>" + System.lineSeparator()
+ "** Customers_and_Shoppers" + System.lineSeparator()
+ "***:<b>Freedom" + System.lineSeparator()
+ "----" + System.lineSeparator()
+ "Priority HIGH" + System.lineSeparator()
+ "Impact MEDIUM" + System.lineSeparator()
+ "-- Consequence --" + System.lineSeparator()
+ "increased freedom" + System.lineSeparator()
+ "; <<green>>" + System.lineSeparator()
+ "***:<b>Sustainability" + System.lineSeparator()
+ "----" + System.lineSeparator()
+ "Priority HIGH" + System.lineSeparator()
+ "Impact LOW" + System.lineSeparator()
+ "-- Consequence --" + System.lineSeparator()
+ "fostering unsustainable behavior (always ordering last minute)" + System.lineSeparator()
+ "; <<red>>" + System.lineSeparator()
+ "@endmindmap" + System.lineSeparator(), valueImpactMapDiagram);
}

@Override
protected String getTestFileDirectory() {
return "/integ-test-files/generators/plantuml/";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.contextmapper.dsl.generators.plantuml.value_impact_mapping.model;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;

import org.junit.jupiter.api.Test;
import org.contextmapper.dsl.generator.plantuml.value_impact_mapping.model.Stakeholder;
import org.contextmapper.dsl.generator.plantuml.value_impact_mapping.model.Value;

class StakeholderTest {

@Test
void ensureStakeholdersWithSameNameAreEqual() {
Stakeholder stakeholder1 = new Stakeholder("User");
Stakeholder stakeholder2 = new Stakeholder("User");

assertTrue(stakeholder1.equals(stakeholder2));
assertTrue(stakeholder1.equals(stakeholder1));
assertFalse(stakeholder1.equals(null));
assertFalse(stakeholder1.equals(new Value("just a test")));
}

}
1 change: 1 addition & 0 deletions org.contextmapper.dsl/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Export-Package: org.contextmapper.dsl,
org.contextmapper.dsl.generator.mdsl,
org.contextmapper.dsl.generator.mdsl.model,
org.contextmapper.dsl.generator.plantuml,
org.contextmapper.dsl.generator.plantuml.value_impact_mapping.model,
org.contextmapper.dsl.generator.sketchminer,
org.contextmapper.dsl.generator.sketchminer.model,
org.contextmapper.dsl.hover,
Expand Down

0 comments on commit cce5d2f

Please sign in to comment.