### Question:
ZabbixAccessor { protected int compareVersion(String apiVersion, String zabbixVersion) { int version1; { String[] array = apiVersion.split("\\."); version1 = Integer.parseInt(array[0]) * 1000 * 1000; version1 += Integer.parseInt(array[1]) * 1000; version1 += (array.length == 3) ? Integer.parseInt(array[2]) : 0; } int version2; { String[] array = zabbixVersion.split("\\."); version2 = Integer.parseInt(array[0]) * 1000 * 1000; version2 += Integer.parseInt(array[1]) * 1000; version2 += (array.length == 3) ? Integer.parseInt(array[2]) : 0; if (version2 <= 1008000) { version2 = 1000000; } else if (version2 == 1008001) { version2 = 1001000; } else if (version2 == 1008002) { version2 = 1002000; } else if (version2 < 2000000) { version2 = 1003000; } else if (version2 <= 2000003) { version2 = 1004000; } } return version1 - version2; } private  ZabbixAccessor(); static ZabbixAccessor getInstance(HttpClient httpClient, String apiUrl, String username, String password); void init(HttpClient httpClient, String apiUrl, String username, String password); synchronized Object execute(String method, JSON params); int checkVersion(String zabbixVersion);  }### Answer:
@Test public void testCompareVersion() { ZabbixAccessor accessor = ZabbixAccessor.getInstance(null, null, null, null); assertTrue(accessor.compareVersion("1.0", "1.8") == 0); assertTrue(accessor.compareVersion("1.1", "1.8.1") == 0); assertTrue(accessor.compareVersion("1.2", "1.8.2") == 0); assertTrue(accessor.compareVersion("1.3", "1.8.3") == 0); assertTrue(accessor.compareVersion("1.3", "1.8.15") == 0); assertTrue(accessor.compareVersion("1.4", "2.0.0") == 0); assertTrue(accessor.compareVersion("1.4", "2.0.3") == 0); assertTrue(accessor.compareVersion("2.0.4", "2.0.4") == 0); assertTrue(accessor.compareVersion("2.2.9", "2.2.9") == 0); assertTrue(accessor.compareVersion("1.3", "2.0") < 0); assertTrue(accessor.compareVersion("3.0.0", "2.2.9") > 0); }