### Question:
ClusterLayoutTracker { public boolean addChangeIfValid(ClusterLayoutChange change) { ClusterLayout currentLayout = getCurrentLayout(); if (change.canApplyChange(currentLayout)) { changes.addLast(change); states.addLast(change.applyChange(currentLayout)); return true; } return false; } ClusterLayoutTracker(ClusterLayout startingLayout); boolean addChangeIfValid(ClusterLayoutChange change); void removeLastChange(); ClusterLayout getCurrentLayout(); Queue<ClusterLayoutChange> getChanges();  }### Answer:
@Test public void testAddIfValidDoesNotAddInvalid() { NodeLayout masterNodeLayout = new NodeLayout("large", "centos6", ImmutableSet.of("master1")); Multiset<NodeLayout> counts = HashMultiset.create(); counts.add(masterNodeLayout); ClusterLayout layout = new ClusterLayout(constraints, counts); ClusterLayoutTracker tracker = new ClusterLayoutTracker(layout); counts = HashMultiset.create(); counts.add(new NodeLayout("medium", "centos6", ImmutableSet.of("master1"))); Assert.assertFalse(tracker.addChangeIfValid(new AddServicesChange(counts, "slave1"))); }