### Question:
ConnectionProperties { public static ConnectionProperties from(Properties properties) throws ConfigurationException { Class<? extends NativeConnectionProvider> nativeConnectionProviderClass = getClassOfType(properties, CONFIG_CONNECTION_NATIVE_CLASS, DEFAULT_CONNECTION_NATIVE_CLASS, NativeConnectionProvider.class); Class<? extends JmxConnectionProvider> jmxConnectionProviderClass = getClassOfType(properties, CONFIG_CONNECTION_JMX_CLASS, DEFAULT_STATEMENT_DECORATOR_CLASS, JmxConnectionProvider.class); Class<? extends StatementDecorator> statementDecoratorClass = getClassOfType(properties, CONFIG_STATEMENT_DECORATOR_CLASS, DEFAULT_CONNECTION_JMX_CLASS, StatementDecorator.class); return new ConnectionProperties(nativeConnectionProviderClass, jmxConnectionProviderClass, statementDecoratorClass); } private  ConnectionProperties(Class<? extends NativeConnectionProvider> nativeConnectionProviderClass,
                                 Class<? extends JmxConnectionProvider> jmxConnectionProviderClass,
                                 Class<? extends StatementDecorator> statementDecoratorClass); Class<? extends NativeConnectionProvider> getNativeConnectionProviderClass(); Class<? extends JmxConnectionProvider> getJmxConnectionProviderClass(); Class<? extends StatementDecorator> getStatementDecoratorClass(); @Override String toString(); static ConnectionProperties from(Properties properties);  }### Answer:
@Test public void testSetNativeConnectionProviderClassWithInvalidConstructor() { Properties properties = new Properties(); properties.put("connection.native.class", NativeConnectionProviderWithInvalidConstructor.class.getName()); assertThatExceptionOfType(ConfigurationException.class).isThrownBy(() -> ConnectionProperties.from(properties)); }
@Test public void testSetNativeConnectionProviderClassWithInvalidClass() { Properties properties = new Properties(); properties.put("connection.native.class", NonOverridingProviderClass.class.getName()); assertThatExceptionOfType(ConfigurationException.class).isThrownBy(() -> ConnectionProperties.from(properties)); }
@Test public void testSetJmxConnectionProviderClassWithInvalidConstructor() { Properties properties = new Properties(); properties.put("connection.jmx.class", JmxConnectionProviderWithInvalidConstructor.class.getName()); assertThatExceptionOfType(ConfigurationException.class).isThrownBy(() -> ConnectionProperties.from(properties)); }
@Test public void testSetJmxConnectionProviderClassWithInvalidClass() { Properties properties = new Properties(); properties.put("connection.jmx.class", NonOverridingProviderClass.class.getName()); assertThatExceptionOfType(ConfigurationException.class).isThrownBy(() -> ConnectionProperties.from(properties)); }
@Test public void testSetStatementDecoratorClassWithInvalidConstructor() { Properties properties = new Properties(); properties.put("connection.native.decorator.class", StatementDecoratorWithInvalidConstructor.class.getName()); assertThatExceptionOfType(ConfigurationException.class).isThrownBy(() -> ConnectionProperties.from(properties)); }
@Test public void testSetStatementDecoratorClassWithInvalidClass() { Properties properties = new Properties(); properties.put("connection.native.decorator.class", NonOverridingProviderClass.class.getName()); assertThatExceptionOfType(ConfigurationException.class).isThrownBy(() -> ConnectionProperties.from(properties)); }