### Question:
AddServicesChange implements ClusterLayoutChange { @Override public boolean canApplyChange(ClusterLayout layout) { if (layout == null || !layout.getLayout().containsAll(countsPerNodeLayout.elementSet())) { return false; } for (Multiset.Entry<NodeLayout> entry : countsPerNodeLayout.entrySet()) { if (layout.getLayout().count(entry.getElement()) < entry.getCount()) { return false; } } return true; } AddServicesChange(Multiset<NodeLayout> countsPerNodeLayout, String service);  AddServicesChange(Multiset<NodeLayout> countsPerNodeLayout, Set<String> services); @Override boolean canApplyChange(ClusterLayout layout); @Override ClusterLayout applyChange(ClusterLayout originalLayout); @Override Set<Node> applyChange(Cluster cluster, Set<Node> clusterNodes, Map<String, Service> serviceMap); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testInvalidNodeLayouts() { NodeLayout masterNodeLayout = new NodeLayout("large-mem", "centos6", ImmutableSet.of("namenode")); Multiset<NodeLayout> counts = HashMultiset.create(); counts.add(masterNodeLayout); NodeLayout badNodeLayout = new NodeLayout("large-mem", "ubuntu12", ImmutableSet.of("namenode")); Multiset<NodeLayout> badCounts = HashMultiset.create(); badCounts.add(badNodeLayout); ClusterLayout layout = new ClusterLayout(constraints, counts); AddServicesChange change = new AddServicesChange(badCounts, "resourcemanager"); Assert.assertFalse(change.canApplyChange(layout)); }