### Question:
JcrDriver implements java.sql.Driver { @Override public boolean acceptsURL( String url ) { return RepositoryDelegateFactory.acceptUrl(url); } JcrDriver(); static JcrDriver getInstance(); @Override boolean acceptsURL( String url ); @Override DriverPropertyInfo[] getPropertyInfo( String url,
                                                 Properties info ); @Override Connection connect( String url,
                               Properties info ); @Override int getMajorVersion(); @Override int getMinorVersion(); String getVendorName(); String getVendorUrl(); String getVersion(); @Override boolean jdbcCompliant(); void setContextFactory( JcrContextFactory factory ); static final String WORKSPACE_PROPERTY_NAME; static final String REPOSITORY_PROPERTY_NAME; static final String USERNAME_PROPERTY_NAME; static final String PASSWORD_PROPERTY_NAME; static final String TEIID_SUPPORT_PROPERTY_NAME; static final String JNDI_URL_PREFIX; static final String HTTP_URL_PREFIX; public JcrContextFactory contextFactory; }### Answer:
@Test public void shouldAcceptValidUrls() { assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX + "java:nameInJndi?workspace=MyWorkspace&user=jsmith&password=secret&teiidsupport=true"), is(true)); assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX + "java:nameInJndi?workspace=MyWorkspace&user=jsmith&password=secret"), is(true)); assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX + "java:nameInJndi?workspace=MyWorkspace&user=jsmith"), is(true)); assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX + "java:nameInJndi?workspace=My%20Workspace"), is(true)); assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX + "java:nameInJndi"), is(true)); assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX + "java:nameInJndi?"), is(true)); assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX + "java"), is(true)); assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX + "j"), is(true)); assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX + "j "), is(true)); assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX + " j"), is(true)); }
@Test public void shouldNotAcceptInvalidUrls() { assertThat(driver.acceptsURL("jdbc:jcr:jndi"), is(false)); assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX), is(false)); assertThat(driver.acceptsURL(JcrDriver.JNDI_URL_PREFIX + " "), is(false)); assertThat(driver.acceptsURL("file: assertThat(driver.acceptsURL("jdbc: }