### Question:
OpenstackApi { protected static String getKeystoneVersion(String url) { final String def = "3"; if (StringUtils.isEmpty(url)) { return def; } int index = url.toLowerCase().lastIndexOf("/v") + 2; if (url.length() > index) { return url.substring(index, index + 1); } return def; } OpenstackApi(String endpointUrl, String identity, String password, String region); String getImageIdByName(String name); String getFlavorIdByName(String name); String getNetworkIdByName(String name); ServerApi getNovaServerApi(); void associateFloatingIp(String serverId, String ip); String getFloatingIpAvailable();  }### Answer:
@Test public void testGetKeystoneVersion() { Assert.assertEquals("3", OpenstackApi.getKeystoneVersion(null)); Assert.assertEquals("3", OpenstackApi.getKeystoneVersion("")); Assert.assertEquals("3", OpenstackApi.getKeystoneVersion("http: Assert.assertEquals("3", OpenstackApi.getKeystoneVersion("http: Assert.assertEquals("4", OpenstackApi.getKeystoneVersion("http: Assert.assertEquals("2", OpenstackApi.getKeystoneVersion("http: Assert.assertEquals("3", OpenstackApi.getKeystoneVersion("http: Assert.assertEquals("2", OpenstackApi.getKeystoneVersion("http: Assert.assertEquals("3", OpenstackApi.getKeystoneVersion("https: Assert.assertEquals("2", OpenstackApi.getKeystoneVersion("https: Assert.assertEquals("3", OpenstackApi.getKeystoneVersion("https: Assert.assertEquals("2", OpenstackApi.getKeystoneVersion("https: Assert.assertEquals("3", OpenstackApi.getKeystoneVersion("https: Assert.assertEquals("2", OpenstackApi.getKeystoneVersion("https: Assert.assertEquals("3", OpenstackApi.getKeystoneVersion("https: Assert.assertEquals("2", OpenstackApi.getKeystoneVersion("https: }