### Question:
ModuleUtil { public static int compareVersion(String version, String value) { try { if (version == null || value == null) { return 0; } List<String> versions = new ArrayList<>(); List<String> values = new ArrayList<>(); String separator = "-"; int qualifierIndex = version.indexOf(separator); if (qualifierIndex != -1) { version = version.substring(0, qualifierIndex); } qualifierIndex = value.indexOf(separator); if (qualifierIndex != -1) { value = value.substring(0, qualifierIndex); } Collections.addAll(versions, version.split("\\.")); Collections.addAll(values, value.split("\\.")); while (versions.size() < values.size()) { versions.add("0"); } while (values.size() < versions.size()) { values.add("0"); } for (int x = 0; x < versions.size(); x++) { String verNum = versions.get(x).trim(); String valNum = values.get(x).trim(); Long ver = NumberUtils.toLong(verNum, 0); Long val = NumberUtils.toLong(valNum, 0); int ret = ver.compareTo(val); if (ret != 0) { return ret; } } } catch (NumberFormatException e) { log.error("Error while converting a version/value to an integer: " + version + "/" + value, e); } return 0; } 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 compareVersion_shouldCorrectlyComparingTwoVersionNumbers() { String olderVersion = "2.1.1"; String newerVersion = "2.1.10"; Assert.assertTrue(ModuleUtil.compareVersion(olderVersion, newerVersion) < 0); }
@Test public void compareVersion_shouldTreatSNAPSHOTAsEarliestVersion() { String olderVersion = "1.8.3"; String newerVersion = "1.8.4-SNAPSHOT"; Assert.assertTrue(ModuleUtil.compareVersion(newerVersion, olderVersion) > 0); Assert.assertTrue(ModuleUtil.compareVersion(olderVersion, newerVersion) < 0); }