component21.setPreferredSize(new Dimension(60, 60));
component31.setPreferredSize(new Dimension(70, 70));
container1.add(component11);
container1.add(component21);
assertEquals(new Dimension(110, 60), layout1.preferredLayoutSize(container1));
assertEquals(new Dimension(60, 110), layout2.preferredLayoutSize(container1));
layout1.invalidateLayout(container1);
layout2.invalidateLayout(container1);
container1.add(component31);
assertEquals(new Dimension(180, 70), layout1.preferredLayoutSize(container1));
assertEquals(new Dimension(70, 180), layout2.preferredLayoutSize(container1));