@Test public void getEligibleAgentsForJob_nonMatchingResources_noObject() { Job job = this.getJobWithResources(1); List<Agent> agents = this.getViableAgentsWithResources(1, 1); agents.get(AGENT_ZERO).getResources().remove("Resource0"); agents.get(AGENT_ZERO).getResources().add("Non-matching resource"); int expectedCollectionSize = TestsConstants.TESTS_COLLECTION_SIZE_NO_OBJECTS; List<Agent> actualResult = this.jobAssignerUtilities.getEligibleAgentsForJob(job, agents); int actualCollectionSize = actualResult.size(); Assert.assertEquals(expectedCollectionSize, actualCollectionSize); }
public List<Agent> getEligibleAgentsForJob(Job job, List<Agent> agents) { List<Agent> eligibleAgents = new ArrayList<>(); for (Agent agent : agents) { boolean isEligible = this.isAgentEligibleForJob(job, agent); if (isEligible) { eligibleAgents.add(agent); } } return eligibleAgents; }
JobAssignerUtilities { public List<Agent> getEligibleAgentsForJob(Job job, List<Agent> agents) { List<Agent> eligibleAgents = new ArrayList<>(); for (Agent agent : agents) { boolean isEligible = this.isAgentEligibleForJob(job, agent); if (isEligible) { eligibleAgents.add(agent); } } return eligibleAgents; } }
JobAssignerUtilities { public List<Agent> getEligibleAgentsForJob(Job job, List<Agent> agents) { List<Agent> eligibleAgents = new ArrayList<>(); for (Agent agent : agents) { boolean isEligible = this.isAgentEligibleForJob(job, agent); if (isEligible) { eligibleAgents.add(agent); } } return eligibleAgents; }  }
JobAssignerUtilities { public List<Agent> getEligibleAgentsForJob(Job job, List<Agent> agents) { List<Agent> eligibleAgents = new ArrayList<>(); for (Agent agent : agents) { boolean isEligible = this.isAgentEligibleForJob(job, agent); if (isEligible) { eligibleAgents.add(agent); } } return eligibleAgents; }  Agent assignAgentToJob(Job job, List<Agent> agents); List<Agent> getEligibleAgentsForJob(Job job, List<Agent> agents); Agent pickMostSuitableAgent(List<Agent> agents); boolean isAgentEligibleForJob(Job job, Agent agent); boolean hasAssignableAgent(Job job, List<Agent> agents); boolean isAssignedAgentEligibleForJob(Job job, Agent agent); }
JobAssignerUtilities { public List<Agent> getEligibleAgentsForJob(Job job, List<Agent> agents) { List<Agent> eligibleAgents = new ArrayList<>(); for (Agent agent : agents) { boolean isEligible = this.isAgentEligibleForJob(job, agent); if (isEligible) { eligibleAgents.add(agent); } } return eligibleAgents; }  Agent assignAgentToJob(Job job, List<Agent> agents); List<Agent> getEligibleAgentsForJob(Job job, List<Agent> agents); Agent pickMostSuitableAgent(List<Agent> agents); boolean isAgentEligibleForJob(Job job, Agent agent); boolean hasAssignableAgent(Job job, List<Agent> agents); boolean isAssignedAgentEligibleForJob(Job job, Agent agent);  }