@Theory public void nullValueReturnsNull(String value) { assumeThat(value, nullValue()); component.setValue(value); Connection connection = converter.getConnection(facesEnv.getFacesContext(), component); assertThat(connection, nullValue()); }
@Theory public void obtainValidConnection(String jndiName) { assumeThat(jndiName, notNullValue()); assumeTrue(jndiName.startsWith("java:")); assumeThat(jndiName, not(containsString("invalid"))); component.setValue(jndiName); Connection connection = converter.getConnection(facesEnv.getFacesContext(), component); assertThat(connection, notNullValue()); }
@Theory @SuppressWarnings("unused") public void invalidJnidNameThrowsNamingEx(String jndiName) { assumeThat(jndiName, notNullValue()); assumeTrue(jndiName.length() > 0); assumeTrue(!jndiName.startsWith("java:")); component.setValue(jndiName); Connection connection; try { connection = converter.getConnection(facesEnv.getFacesContext(), component); fail("A NamingException was expected"); } catch (Exception e) { assertThat(e, is(SourceException.class)); } }