### Question:
DeploymentPlanFilterer { public static List<DeploymentPlan> filterDeploymentPlansThatUseHost(List<DeploymentPlan> deploymentPlans, String hostname) { List<DeploymentPlan> result = new ArrayList<>(); for (DeploymentPlan deploymentPlan: deploymentPlans) { boolean bannedHostUsed = false; for (VmAssignmentToHost vmAssignment: deploymentPlan.getVmsAssignationsToHosts()) { if (vmAssignment.getHost().getHostname().equals(hostname)) { bannedHostUsed = true; } } if (!bannedHostUsed) { result.add(deploymentPlan); } } return result; }  static List<DeploymentPlan> filterDeploymentPlans(List<DeploymentPlan> deploymentPlans); static List<DeploymentPlan> filterDeploymentPlansThatUseHost(List<DeploymentPlan> deploymentPlans,
                                                                        String hostname);  }### Answer:
@Test public void filterDeploymentPlansThatUseHost() { Vm vm1 = new Vm("vm1", "fakeImage", 1, 1024, 1, "", ""); Vm vm2 = new Vm("vm2", "fakeImage", 2, 2048, 2, "", ""); Host host1 = new HostFake("host1", 2, 2048, 2, 0, 0, 0); Host host2 = new HostFake("host2", 2, 2048, 2, 0, 0, 0); VmAssignmentToHost vm1ToHost1 = new VmAssignmentToHost(vm1, host1); VmAssignmentToHost vm2ToHost1 = new VmAssignmentToHost(vm2, host1); VmAssignmentToHost vm2ToHost2 = new VmAssignmentToHost(vm2, host2); List<DeploymentPlan> deploymentPlans = new ArrayList<>(); DeploymentPlan dp1 = new DeploymentPlan(getAssignmentsList(vm1ToHost1, vm2ToHost1)); deploymentPlans.add(dp1); DeploymentPlan dp2 = new DeploymentPlan(getAssignmentsList(vm1ToHost1, vm2ToHost2)); deploymentPlans.add(dp2); List<DeploymentPlan> planWithoutHost2 = DeploymentPlanFilterer.filterDeploymentPlansThatUseHost(deploymentPlans, "host2"); assertTrue(planWithoutHost2.contains(dp1)); assertFalse(planWithoutHost2.contains(dp2)); }