@Test public void test_copyLayoutInformationFrom_DoesNotDoAnythingIfThereIsNoDynamicViewToCopyInformationFrom() { Workspace workspace1 = createWorkspace(); Workspace workspace2 = createWorkspace(); Person person2 = workspace2.getModel().getPersonWithName("Person"); SoftwareSystem softwareSystem2 = workspace2.getModel().getSoftwareSystemWithName("Software System"); DynamicView view2 = workspace2.getViews().createDynamicView("context", "Description"); view2.add(person2, softwareSystem2); workspace2.getViews().copyLayoutInformationFrom(workspace1.getViews()); assertEquals(0, view2.getElements().iterator().next().getX()); // default assertNull(view2.getPaperSize()); // default }
@Test public void test_copyLayoutInformationFrom_WhenTheDynamicViewKeysMatch() { Workspace workspace1 = createWorkspace(); Person person1 = workspace1.getModel().getPersonWithName("Person"); SoftwareSystem softwareSystem1 = workspace1.getModel().getSoftwareSystemWithName("Software System"); DynamicView view1 = workspace1.getViews().createDynamicView("context", "Description"); view1.add(person1, softwareSystem1); view1.getElements().iterator().next().setX(100); view1.setPaperSize(PaperSize.A3_Landscape); Workspace workspace2 = createWorkspace(); Person person2 = workspace2.getModel().getPersonWithName("Person"); SoftwareSystem softwareSystem2 = workspace2.getModel().getSoftwareSystemWithName("Software System"); DynamicView view2 = workspace2.getViews().createDynamicView("context", "Description"); view2.add(person2, softwareSystem2); workspace2.getViews().copyLayoutInformationFrom(workspace1.getViews()); assertEquals(100, view2.getElements().iterator().next().getX()); assertEquals(PaperSize.A3_Landscape, view2.getPaperSize()); }