### Question:
DeploymentPlanFilterer { public static List<DeploymentPlan> filterDeploymentPlans(List<DeploymentPlan> deploymentPlans) { List<DeploymentPlan> result = new ArrayList<>(); for (DeploymentPlan deploymentPlan: deploymentPlans) { if (deploymentPlan.canBeApplied()) { 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 filterDeploymentPlans() { 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 vm1ToHost2 = new VmAssignmentToHost(vm1, host2); 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); DeploymentPlan dp3 = new DeploymentPlan(getAssignmentsList(vm1ToHost2, vm2ToHost1)); deploymentPlans.add(dp3); DeploymentPlan dp4 = new DeploymentPlan(getAssignmentsList(vm1ToHost2, vm2ToHost2)); deploymentPlans.add(dp4); List<DeploymentPlan> filteredDeploymentPlans = DeploymentPlanFilterer.filterDeploymentPlans(deploymentPlans); assertTrue(filteredDeploymentPlans.contains(dp2) && filteredDeploymentPlans.contains(dp3)); assertTrue(!filteredDeploymentPlans.contains(dp1) && !filteredDeploymentPlans.contains(dp4)); }