LocalizerResourceConfig { public Path getResourcePath(final String resourceName) { String pathStr = config.get(String.format(RESOURCE_PATH, resourceName)); if (StringUtils.isEmpty(pathStr)) { throw new LocalizerResourceException("resource path is required but not defined in config for resource " + resourceName); } return new Path(pathStr); } LocalizerResourceConfig(final Config config); List<String> getResourceNames(); Path getResourcePath(final String resourceName); LocalResourceType getResourceLocalType(final String resourceName); LocalResourceVisibility getResourceLocalVisibility(final String resourceName); String getResourceLocalName(final String resourceName);  }
@Test public void testInvalidPath() { thrown.expect(LocalizerResourceException.class); thrown.expectMessage("resource path is required but not defined in config for resource myResource1"); Map<String, String> configMap = new HashMap<>(); configMap.put("yarn.resources.myResource1.path", ""); configMap.put("yarn.resources.myResource1.local.name", "readme"); configMap.put("yarn.resources.myResource1.local.type", "invalidType"); configMap.put("yarn.resources.myResource1.local.visibility", "application"); Config conf = new MapConfig(configMap); LocalizerResourceConfig manager = new LocalizerResourceConfig(conf); manager.getResourcePath("myResource1"); }