### Question:
ListModels { private ListModels() {} private  ListModels(); static void main(String[] args);  }### Answer:
@Test public void testListModels() throws ModelException, IOException { Path path = Paths.get("../model-zoo/src/test/resources/mlrepo"); String repoUrl = path.toRealPath().toAbsolutePath().toUri().toURL().toExternalForm(); System.setProperty("ai.djl.repository.zoo.location", "src/test/resources," + repoUrl); Map<Application, List<Artifact>> models = ModelZoo.listModels(); List<Artifact> artifacts = models.get(Application.UNDEFINED); Assert.assertFalse(artifacts.isEmpty()); }
@Test public void testListModelsWithApplication() throws ModelException, IOException { Path path = Paths.get("../model-zoo/src/test/resources/mlrepo"); String repoUrl = path.toRealPath().toAbsolutePath().toUri().toURL().toExternalForm(); System.setProperty("ai.djl.repository.zoo.location", "src/test/resources," + repoUrl); Criteria<?, ?> criteria = Criteria.builder().optApplication(NLP.ANY).build(); Map<Application, List<Artifact>> models = ModelZoo.listModels(criteria); for (Application application : models.keySet()) { Assert.assertTrue( application.matches(NLP.ANY) || application.matches(Application.UNDEFINED)); Assert.assertFalse(application.matches(CV.ANY)); } }