@Test public void test_copyLayoutInformationFrom_DoesNotDoAnythingIfThereIsNoContainerViewToCopyInformationFrom() { Workspace workspace1 = createWorkspace(); Workspace workspace2 = createWorkspace(); SoftwareSystem softwareSystem2 = workspace2.getModel().getSoftwareSystemWithName("Software System"); ContainerView view2 = workspace2.getViews().createContainerView(softwareSystem2, "containers", "Description"); view2.addAllElements(); workspace2.getViews().copyLayoutInformationFrom(workspace1.getViews()); assertEquals(0, view2.getElements().iterator().next().getX()); // default assertNull(view2.getPaperSize()); // default }
@Test public void test_copyLayoutInformationFrom_WhenTheContainerViewKeysMatch() { Workspace workspace1 = createWorkspace(); SoftwareSystem softwareSystem1 = workspace1.getModel().getSoftwareSystemWithName("Software System"); ContainerView view1 = workspace1.getViews().createContainerView(softwareSystem1, "containers", "Description"); view1.addAllElements(); view1.getElements().iterator().next().setX(100); view1.setPaperSize(PaperSize.A3_Landscape); Workspace workspace2 = createWorkspace(); SoftwareSystem softwareSystem2 = workspace2.getModel().getSoftwareSystemWithName("Software System"); ContainerView view2 = workspace2.getViews().createContainerView(softwareSystem2, "containers", "Description"); view2.addAllElements(); workspace2.getViews().copyLayoutInformationFrom(workspace1.getViews()); assertEquals(100, view2.getElements().iterator().next().getX()); assertEquals(PaperSize.A3_Landscape, view2.getPaperSize()); }