### Question:
ModuleUtil { public static InputStream getResourceFromApi(JarFile jarFile, String moduleId, String version, String resource) { String apiLocation = "lib/" + moduleId + "-api-" + version + ".jar"; return getResourceFromInnerJar(jarFile, apiLocation, resource); } private  ModuleUtil(); static void startup(Properties props); static void shutdown(); static File insertModuleFile(InputStream inputStream, String filename); static boolean isOpenmrsVersionInVersions(String ...versions); static boolean matchRequiredVersions(String version, String versionRange); static void checkRequiredVersion(String version, String versionRange); static int compareVersion(String version, String value); static boolean isVersionWithQualifier(String version); static File getModuleRepository(); static URL file2url(final File file); static void expandJar(File fileToExpand, File tmpModuleDir, String name, boolean keepFullPath); static InputStream getURLStream(URL url); static String getURL(URL url); static Boolean checkForModuleUpdates(); static Boolean allowAdmin(); static AbstractRefreshableApplicationContext refreshApplicationContext(AbstractRefreshableApplicationContext ctx); static AbstractRefreshableApplicationContext refreshApplicationContext(AbstractRefreshableApplicationContext ctx,
	        boolean isOpenmrsStartup, Module startedModule); static boolean ignoreCoreModules(); static List<String> getMandatoryModules(); static Module getModuleForPath(String path); static String getPathForResource(Module module, String path); static Collection<String> getPackagesFromFile(File file); static InputStream getResourceFromApi(JarFile jarFile, String moduleId, String version, String resource); static File getDevelopmentDirectory(String moduleId);  }### Answer:
@Test public void getResourceFromApi_shouldLoadFileFromApiAsInputStream() throws IOException { String moduleId = "test1"; String version = "1.0-SNAPSHOT"; String resource = "messages.properties"; JarFile moduleJarFile = loadModuleJarFile(moduleId, version); Assert.assertNotNull(moduleJarFile); InputStream resultStream = ModuleUtil.getResourceFromApi(moduleJarFile, moduleId, version, resource); Assert.assertNotNull(resultStream); }
@Test public void getResourceFromApi_shouldReturnNullIfApiIsNotFound() throws IOException { String moduleId = "logic"; String version = "0.2"; String resource = "messages.properties"; JarFile moduleJarFile = loadModuleJarFile(moduleId, version); Assert.assertNotNull(moduleJarFile); InputStream resultStream = ModuleUtil.getResourceFromApi(moduleJarFile, moduleId, version, resource); Assert.assertNull(resultStream); }
@Test public void getResourceFromApi_shouldReturnNullIfFileIsNotFoundInApi() throws IOException { String moduleId = "test1"; String version = "1.0-SNAPSHOT"; String resource = "messages_doesnotexist.properties"; JarFile moduleJarFile = loadModuleJarFile(moduleId, version); Assert.assertNotNull(moduleJarFile); InputStream resultStream = ModuleUtil.getResourceFromApi(moduleJarFile, moduleId, version, resource); Assert.assertNull(resultStream); }