### Question:
AbstractConnectionSpecFactory implements ConnectionSpecFactory { protected Class<? extends ConnectionSpec> getConnectionSpecClass(final String connectionSpecClass) throws ClassNotFoundException { Class<?> connSpecClass = ReflectionHelper.getClassForName(connectionSpecClass); if (!ConnectionSpec.class.isAssignableFrom(connSpecClass)) { throw new IllegalArgumentException( connSpecClass.getName() + " does not implement " + ConnectionSpec.class); } return (Class<? extends ConnectionSpec>) connSpecClass; }    }### Answer:
@Test public void getConnectionSpecClassReturnsCorrectClass() throws Exception { Class<?> specClass = factory .getConnectionSpecClass(TestConnectionSpecImpl.class.getName()); assertThat(specClass).isEqualTo(TestConnectionSpecImpl.class); }
@Test(expected = IllegalArgumentException.class) public void getConnectionSpecClassThrowsIllegalArgumentWhenGivenClassIsNotAConnectionSpec() throws Exception { factory.getConnectionSpecClass(String.class.getName()); }
@Test(expected = ClassNotFoundException.class) public void getConnectionSpecThrowsClassNotFoundWhenCalledWithNonExistingClassName() throws Exception { factory.getConnectionSpecClass("NonExistingClass"); }