DependencyListView extends View { public Table getTable(){ final Table table = new Table(getHeaders()); for(final Dependency dependency: dependencies){ final List<String> licenseIds = dependency.getTarget().getLicenses(); if(licenseIds.isEmpty()){ table.addRow(getDependencyCells(dependency, DataModelFactory.createLicense("","","","",""))); } else{ for(final String licenseId: dependency.getTarget().getLicenses()){ final License license = getLicense(licenseId); table.addRow(getDependencyCells(dependency, license)); } } } return table; } DependencyListView(final String title,
                              final Decorator decorator,
                              final LicenseMatcher licenseMatcher,
                              final ModelMapper mapper,
                              final String templateName); String getTitle(); void addDependency(final Dependency dependency); void addAll(final List<Dependency> dependencies); List<Dependency> getDependencies(); Table getTable(); String getArtifactLink(String gavc); static final String NOT_IDENTIFIED_YET; static final String SOURCE_FIELD; static final String SOURCE_VERSION_FIELD; static final String TARGET_FIELD; static final String DOWNLOAD_URL_FIELD; static final String SIZE_FIELD; static final String SCOPE_FIELD; static final String LICENSE_FIELD; static final String LICENSE_LONG_NAME_FIELD; static final String LICENSE_URL_FIELD; static final String LICENSE_COMMENT_FIELD; }
@Test public void checkEmptyDependencyList(){ final DependencyListView depList = new DependencyListView("test", new Decorator(), mock(LicenseMatcher.class), mock(ModelMapper.class), "DependencyListView.ftl"); final Table results = depList.getTable(); assertNotNull(results); assertEquals(0, results.size()); }