@Test public void publish_project_without_version_and_name() throws IOException { ProjectAnalysisInfo projectAnalysisInfo = mock(ProjectAnalysisInfo.class); when(projectAnalysisInfo.analysisDate()).thenReturn(DateUtils.parseDate("2012-12-12")); ProjectDefinition rootDef = ProjectDefinition.create() .setKey("foo") .setDescription("Root description") .setBaseDir(temp.newFolder()) .setWorkDir(temp.newFolder()); DefaultInputProject project = new DefaultInputProject(rootDef, 1); InputComponentStore store = new InputComponentStore(branchConfiguration); ComponentsPublisher publisher = new ComponentsPublisher(project, store); publisher.publish(writer); assertThat(writer.hasComponentData(FileStructure.Domain.COMPONENT, 1)).isTrue(); ScannerReportReader reader = new ScannerReportReader(outputDir); Component rootProtobuf = reader.readComponent(1); assertThat(rootProtobuf.getKey()).isEqualTo("foo"); assertThat(rootProtobuf.getName()).isEqualTo(""); assertThat(rootProtobuf.getDescription()).isEqualTo("Root description"); assertThat(rootProtobuf.getVersion()).isEqualTo(""); assertThat(rootProtobuf.getLinkCount()).isEqualTo(0); }
Component rootProtobuf = reader.readComponent(1); assertThat(rootProtobuf.getVersion()).isEqualTo("1.0"); assertThat(rootProtobuf.getLinkCount()).isEqualTo(2); assertThat(rootProtobuf.getLink(0).getType()).isEqualTo(ComponentLinkType.HOME); assertThat(rootProtobuf.getLink(0).getHref()).isEqualTo("http://home");
assertThat(rootProtobuf.getDescription()).isEqualTo("Root description"); assertThat(rootProtobuf.getVersion()).isEqualTo("1.0"); assertThat(rootProtobuf.getLinkCount()).isEqualTo(0);