@Test public void testExpandRatio() { AbstractOrderedLayout layout = new AbstractOrderedLayout() {}; AbstractComponent first = new AbstractComponent() {}; AbstractComponent second = new AbstractComponent() {}; layout.addComponent(first); layout.addComponent(second); int ratio = 2; layout.setExpandRatio(first, ratio); layout.setExpandRatio(second, 1); AbstractComponent replace = new AbstractComponent() {}; layout.replaceComponent(first, replace); Assert.assertEquals( "Expand ratio for replaced component is not " + "the same as for previous one", ratio, layout.getExpandRatio(replace), 0.0001); }