UpgradeCatalog200 extends AbstractUpgradeCatalog { static String repositoryTable(List<RepositoryInfo> repositories) { StringBuilder result = new StringBuilder(); for (RepositoryInfo repository : repositories) { result.append(String.format(" %8s |", repository.getOsType())); result.append(String.format(" %18s |", repository.getRepoId())); result.append(String.format(" %48s ", repository.getBaseUrl())); result.append("\n"); } return result.toString(); } @Inject  UpgradeCatalog200(Injector injector); @Override String getTargetVersion(); @Override void executePreDMLUpdates();  }
@Test public void testRepositoryTable() { final RepositoryInfo repositoryInfo1 = new RepositoryInfo(); repositoryInfo1.setOsType("redhat6"); repositoryInfo1.setRepoId("HDP-2.2"); repositoryInfo1.setBaseUrl("http: final RepositoryInfo repositoryInfo2 = new RepositoryInfo(); repositoryInfo2.setOsType("suse11"); repositoryInfo2.setRepoId("HDP-UTILS-1.1.0.20"); repositoryInfo2.setBaseUrl("http: List<RepositoryInfo> repos = new ArrayList<RepositoryInfo>() {{ add(repositoryInfo1); add(repositoryInfo2); }}; String output = UpgradeCatalog200.repositoryTable(repos); assertEquals(" redhat6 | HDP-2.2 | http: " suse11 | HDP-UTILS-1.1.0.20 | http: output); }