### Question:
ProductCatalogManager { protected Resource getNewestResource(Resource rez) { List<Resource> files = rez.listResources(); if (files != null && files.size() > 0) { List<Resource> sorted = files.stream().sorted(Comparator.comparing((Resource r1) -> getProdCatVersion(r1)).reversed()).collect(Collectors.toList()); rez = sorted.get(0); } return rez; } @Inject  ProductCatalogManager(ProductCatalogConfig config);  ProductCatalogManager(Resource catalogResource); ProductCatalog getCatalog(String population); void loadCatalogs(Integer version); String getProductCatalogPath(); int getProductCatalogVersion(); Resource getCatalogResource();  }### Answer:
@Test public void testParseProductCatalog() throws Exception { URI uri = new URI("classpath:/test1.xml"); assertNotNull(uri); ClassPathResourceFactory factory = new ClassPathResourceFactory(TestProductCatalogManager.class); Resource resource = factory.create(uri); ProductCatalogManager prodCatMan = new ProductCatalogManager(resource); Resource found = prodCatMan.getNewestResource(resource); assertEquals("classpath:/test1.xml", found.getRepresentation()); }
@Test public void testFindVersion() throws Exception { URI uri = new URI("classpath:/folder/"); assertNotNull(uri); ClassPathResourceFactory factory = new ClassPathResourceFactory(TestProductCatalogManager.class); Resource resource = factory.create(uri); ProductCatalogManager prodCatMan = new ProductCatalogManager(resource); Resource found = prodCatMan.getNewestResource(resource); assertEquals("classpath:/folder/test100.xml", found.getRepresentation()); }