diff --git a/diylc/.DS_Store b/diylc/.DS_Store
index 1327d980..9caebd44 100644
Binary files a/diylc/.DS_Store and b/diylc/.DS_Store differ
diff --git a/diylc/diylc-core/pom.xml b/diylc/diylc-core/pom.xml
index a96995f3..3e43518b 100644
--- a/diylc/diylc-core/pom.xml
+++ b/diylc/diylc-core/pom.xml
@@ -79,5 +79,11 @@
java-http-proxy
1.0
+
+ org.mockito
+ mockito-core
+ 5.3.1
+ test
+
diff --git a/diylc/diylc-core/src/main/java/org/diylc/presenter/ComponentProcessor.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/ComponentProcessor.java
index 2bab6e2b..3b839c92 100644
--- a/diylc/diylc-core/src/main/java/org/diylc/presenter/ComponentProcessor.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/ComponentProcessor.java
@@ -311,4 +311,9 @@ public class ComponentProcessor {
return true;
return false;
}
+
+ // Add this method for testing purposes
+ protected void setComponentTypeForTest(Class extends IDIYComponent>> componentClass, ComponentType componentType) {
+ componentTypeMap.put(componentClass.getName(), componentType);
+ }
}
diff --git a/diylc/diylc-core/src/main/java/org/diylc/presenter/Presenter.java b/diylc/diylc-core/src/main/java/org/diylc/presenter/Presenter.java
index a8b9c3b3..6ac63270 100644
--- a/diylc/diylc-core/src/main/java/org/diylc/presenter/Presenter.java
+++ b/diylc/diylc-core/src/main/java/org/diylc/presenter/Presenter.java
@@ -192,23 +192,25 @@ public class Presenter implements IPlugInPort, IConfigListener {
}
public Presenter(IView view, IConfigurationManager> configManager, boolean importVariantsAndBlocks) {
+ this(view, configManager, importVariantsAndBlocks, new MessageDispatcher(true));
+ }
+
+ // New constructor for testing
+ protected Presenter(IView view, IConfigurationManager> configManager, boolean importVariantsAndBlocks, MessageDispatcher messageDispatcher) {
super();
this.view = view;
this.configManager = configManager;
+ this.messageDispatcher = messageDispatcher;
plugIns = new ArrayList();
- messageDispatcher = new MessageDispatcher(true);
selectedComponents = new HashSet>();
lockedComponents = new HashSet>();
currentProject = new Project();
- // cloner = new Cloner();
drawingManager = new DrawingManager(messageDispatcher, configManager);
projectFileManager = new ProjectFileManager(messageDispatcher);
instantiationManager = new InstantiationManager();
variantManager = new VariantManager(configManager, projectFileManager.getXStream());
buildingBlockManager = new BuildingBlockManager(configManager, projectFileManager.getXStream(), instantiationManager);
- // lockedLayers = EnumSet.noneOf(ComponentLayer.class);
- // visibleLayers = EnumSet.allOf(ComponentLayer.class);
if (importVariantsAndBlocks) {
variantManager.upgradeVariants(getComponentTypes());
variantManager.importDefaultVariants();
@@ -2857,4 +2859,8 @@ public class Presenter implements IPlugInPort, IConfigListener {
messageDispatcher.dispatchMessage(EventType.REPAINT);
}
}
+
+ protected MessageDispatcher getMessageDispatcher() {
+ return messageDispatcher;
+ }
}