@Test(expected=RuntimeException.class) public void testConversionOnInvalidProjectId() throws Exception { ProjectDetail source = new ProjectDetail(); source.setProjectId("invalidId"); converter.convert(source); }
public Project convert(ProjectDetail source) throws IOException { Project.Builder builder = Project.newBuilder(); builder.setId(normalizeId(source.getProjectId())); if (ProjectConverter.isAcronymValid(source.getAcronym())) { builder.setProjectAcronym(source.getAcronym()); } if (StringUtils.isNotBlank(source.getCode())) { builder.setProjectGrantId(source.getCode()); } if (StringUtils.isNotBlank(source.getJsonextrainfo())) { builder.setJsonextrainfo(source.getJsonextrainfo()); } else { builder.setJsonextrainfo(ProjectConverter.BLANK_JSONEXTRAINFO); } if (CollectionUtils.isNotEmpty(source.getFundingPath())) { builder.setFundingClass(fundingTreeParser.extractFundingClass(source.getFundingPath())); } return builder.build(); }
ProjectDetailConverter { public Project convert(ProjectDetail source) throws IOException { Project.Builder builder = Project.newBuilder(); builder.setId(normalizeId(source.getProjectId())); if (ProjectConverter.isAcronymValid(source.getAcronym())) { builder.setProjectAcronym(source.getAcronym()); } if (StringUtils.isNotBlank(source.getCode())) { builder.setProjectGrantId(source.getCode()); } if (StringUtils.isNotBlank(source.getJsonextrainfo())) { builder.setJsonextrainfo(source.getJsonextrainfo()); } else { builder.setJsonextrainfo(ProjectConverter.BLANK_JSONEXTRAINFO); } if (CollectionUtils.isNotEmpty(source.getFundingPath())) { builder.setFundingClass(fundingTreeParser.extractFundingClass(source.getFundingPath())); } return builder.build(); } }
ProjectDetailConverter { public Project convert(ProjectDetail source) throws IOException { Project.Builder builder = Project.newBuilder(); builder.setId(normalizeId(source.getProjectId())); if (ProjectConverter.isAcronymValid(source.getAcronym())) { builder.setProjectAcronym(source.getAcronym()); } if (StringUtils.isNotBlank(source.getCode())) { builder.setProjectGrantId(source.getCode()); } if (StringUtils.isNotBlank(source.getJsonextrainfo())) { builder.setJsonextrainfo(source.getJsonextrainfo()); } else { builder.setJsonextrainfo(ProjectConverter.BLANK_JSONEXTRAINFO); } if (CollectionUtils.isNotEmpty(source.getFundingPath())) { builder.setFundingClass(fundingTreeParser.extractFundingClass(source.getFundingPath())); } return builder.build(); }  }
ProjectDetailConverter { public Project convert(ProjectDetail source) throws IOException { Project.Builder builder = Project.newBuilder(); builder.setId(normalizeId(source.getProjectId())); if (ProjectConverter.isAcronymValid(source.getAcronym())) { builder.setProjectAcronym(source.getAcronym()); } if (StringUtils.isNotBlank(source.getCode())) { builder.setProjectGrantId(source.getCode()); } if (StringUtils.isNotBlank(source.getJsonextrainfo())) { builder.setJsonextrainfo(source.getJsonextrainfo()); } else { builder.setJsonextrainfo(ProjectConverter.BLANK_JSONEXTRAINFO); } if (CollectionUtils.isNotEmpty(source.getFundingPath())) { builder.setFundingClass(fundingTreeParser.extractFundingClass(source.getFundingPath())); } return builder.build(); }  Project convert(ProjectDetail source); }
ProjectDetailConverter { public Project convert(ProjectDetail source) throws IOException { Project.Builder builder = Project.newBuilder(); builder.setId(normalizeId(source.getProjectId())); if (ProjectConverter.isAcronymValid(source.getAcronym())) { builder.setProjectAcronym(source.getAcronym()); } if (StringUtils.isNotBlank(source.getCode())) { builder.setProjectGrantId(source.getCode()); } if (StringUtils.isNotBlank(source.getJsonextrainfo())) { builder.setJsonextrainfo(source.getJsonextrainfo()); } else { builder.setJsonextrainfo(ProjectConverter.BLANK_JSONEXTRAINFO); } if (CollectionUtils.isNotEmpty(source.getFundingPath())) { builder.setFundingClass(fundingTreeParser.extractFundingClass(source.getFundingPath())); } return builder.build(); }  Project convert(ProjectDetail source);  }