ForceDriver implements Driver { protected Properties getConnStringProperties(String url) throws IOException { Properties result = new Properties(); String urlProperties = null; Matcher stdMatcher = URL_PATTERN.matcher(url); Matcher authMatcher = URL_HAS_AUTHORIZATION_SEGMENT.matcher(url); if (authMatcher.matches()) { urlProperties = "user=" + authMatcher.group(1) + "\npassword=" + authMatcher.group(2); } else if (stdMatcher.matches()) { urlProperties = stdMatcher.group(1); urlProperties = urlProperties.replaceAll(";", "\n"); } if (urlProperties != null) { try (InputStream in = new ByteArrayInputStream(urlProperties.getBytes(StandardCharsets.UTF_8))) { result.load(in); } } return result; }  @Override Connection connect(String url, Properties properties); @Override boolean acceptsURL(String url); @Override DriverPropertyInfo[] getPropertyInfo(String url, Properties info); @Override int getMajorVersion(); @Override int getMinorVersion(); @Override boolean jdbcCompliant(); @Override Logger getParentLogger();  }
@Test public void testGetConnStringProperties() throws IOException { Properties actuals = driver.getConnStringProperties("jdbc:ascendix:salesforce: assertEquals(2, actuals.size()); assertEquals("val1", actuals.getProperty("prop1")); assertEquals("val2", actuals.getProperty("prop2")); }
@Test public void testGetConnStringProperties_WhenNoValue() throws IOException { Properties actuals = driver.getConnStringProperties("jdbc:ascendix:salesforce: assertEquals(3, actuals.size()); assertTrue(actuals.containsKey("prop2")); assertEquals("", actuals.getProperty("prop2")); }
@Test public void testGetConnStringProperties_StandartUrlFormat() throws IOException { Properties actuals = driver.getConnStringProperties("jdbc:ascendix:salesforce: assertEquals(2, actuals.size()); assertTrue(actuals.containsKey("user")); assertEquals("test@test.ru", actuals.getProperty("user")); assertEquals("aaaa!aaa", actuals.getProperty("password")); }