@Test public void testValidatePlantPageDataWithNonExistingArticle() { PlantBag plantBag = plantBagBuilder.initializeProjectDataAndAddToPlantBag("Project D").createPlantItemAndAddToPlantBag(4, 100, "wood", "Project D").build(); try { _plantBagValidator.validatePlantBag(plantBag); } catch (IpatException e) { List<IpatErrorInfo> errorInfos = e.getErrorInfos(); assertEquals(1, errorInfos.size()); IpatErrorInfo error = errorInfos.get(0); assertEquals(ErrorCodes.ARTICLE_DOES_NOT_EXISTS, error.getErrorCode()); assertEquals("Project D", error.getErrorParams()[0]); assertEquals("wood", error.getErrorParams()[1]); } }
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);  }