private <T> void assertListsAreEqual(List<T> a, List<T> b) { Assert.areEqual(a.size(), b.size()); for (int i = 0; i < a.size(); i++) { Assert.areEqual(a.get(i), b.get(i)); } }
public void addConfigurationItem(ServerConfigurationItem configItem) { if (_configItems != null && _configItems.contains(configItem)) { return; } configItem.prepare(this); if (_configItems == null) { _configItems = new ArrayList<ServerConfigurationItem>(); } _configItems.add(configItem); }
public void testPrepareApply() { List<DummyConfigurationItem> items = Arrays.asList(new DummyConfigurationItem(_applied), new DummyConfigurationItem(_applied)); for (DummyConfigurationItem item : items) { _config.addConfigurationItem(item); Assert.areEqual(1, item.prepareCount()); } Assert.areEqual(0, _applied.size()); _config.applyConfigurationItems(new MockServer()); assertListsAreEqual(items, _applied); for (DummyConfigurationItem item : items) { Assert.areEqual(1, item.prepareCount()); } }
public void apply(ObjectServer server) { _applied.add(this); }