@Test public void testValidatePlantPageDataWithOneArticleToTrue() { PlantBag plantBag = plantBagBuilder.initializeProjectDataAndAddToPlantBag("Project A").createPlantItemAndAddToPlantBag(5, 100, "wood", "Project A").build(); try { _plantBagValidator.validatePlantBag(plantBag); } catch (IpatException e) { String errorCode = e.getErrorInfos().get(0).getErrorCode(); fail("plantBag should be valid\nerrorCode:" + errorCode); } }
public void validatePlantBag(PlantBag plantBag) throws IpatException { Set<String> projectNames = plantBag.getProjects().keySet(); checkProjects(plantBag, projectNames); if (errorInfos.size() > 0) { List<IpatErrorInfo> returnedErrors = this.errorInfos; this.errorInfos = new ArrayList<IpatErrorInfo>(); throw new IpatException(returnedErrors); } }
PlantBagValidator extends AbstractPlantBagValidator { public void validatePlantBag(PlantBag plantBag) throws IpatException { Set<String> projectNames = plantBag.getProjects().keySet(); checkProjects(plantBag, projectNames); if (errorInfos.size() > 0) { List<IpatErrorInfo> returnedErrors = this.errorInfos; this.errorInfos = new ArrayList<IpatErrorInfo>(); throw new IpatException(returnedErrors); } } }
PlantBagValidator extends AbstractPlantBagValidator { public void validatePlantBag(PlantBag plantBag) throws IpatException { Set<String> projectNames = plantBag.getProjects().keySet(); checkProjects(plantBag, projectNames); if (errorInfos.size() > 0) { List<IpatErrorInfo> returnedErrors = this.errorInfos; this.errorInfos = new ArrayList<IpatErrorInfo>(); throw new IpatException(returnedErrors); } } @Autowired private  PlantBagValidator(TreeRepository treeRepository, ProjectArticleRepository projectArticleRepository, ProjectRepository projectRepository); }
PlantBagValidator extends AbstractPlantBagValidator { public void validatePlantBag(PlantBag plantBag) throws IpatException { Set<String> projectNames = plantBag.getProjects().keySet(); checkProjects(plantBag, projectNames); if (errorInfos.size() > 0) { List<IpatErrorInfo> returnedErrors = this.errorInfos; this.errorInfos = new ArrayList<IpatErrorInfo>(); throw new IpatException(returnedErrors); } } @Autowired private  PlantBagValidator(TreeRepository treeRepository, ProjectArticleRepository projectArticleRepository, ProjectRepository projectRepository); void validatePlantBag(PlantBag plantBag); }
PlantBagValidator extends AbstractPlantBagValidator { public void validatePlantBag(PlantBag plantBag) throws IpatException { Set<String> projectNames = plantBag.getProjects().keySet(); checkProjects(plantBag, projectNames); if (errorInfos.size() > 0) { List<IpatErrorInfo> returnedErrors = this.errorInfos; this.errorInfos = new ArrayList<IpatErrorInfo>(); throw new IpatException(returnedErrors); } } @Autowired private  PlantBagValidator(TreeRepository treeRepository, ProjectArticleRepository projectArticleRepository, ProjectRepository projectRepository); void validatePlantBag(PlantBag plantBag);  }