Polishing
This commit is contained in:
@@ -40,6 +40,7 @@ public class DelegatingDataSourceTests {
|
||||
|
||||
private DelegatingDataSource dataSource = new DelegatingDataSource(delegate);
|
||||
|
||||
|
||||
@Test
|
||||
public void shouldDelegateGetConnection() throws Exception {
|
||||
Connection connection = mock();
|
||||
@@ -109,10 +110,12 @@ public class DelegatingDataSourceTests {
|
||||
assertThat(dataSource.isWrapperFor(ExampleWrapper.class)).isTrue();
|
||||
}
|
||||
|
||||
|
||||
public interface ExampleWrapper {
|
||||
}
|
||||
|
||||
private static class DelegatingDataSourceWithWrapper extends DelegatingDataSource
|
||||
implements ExampleWrapper {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,10 +30,11 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
public class DriverManagerDataSourceTests {
|
||||
|
||||
private Connection connection = mock();
|
||||
private final Connection connection = mock();
|
||||
|
||||
|
||||
@Test
|
||||
public void testStandardUsage() throws Exception {
|
||||
public void standardUsage() throws Exception {
|
||||
final String jdbcUrl = "url";
|
||||
final String uname = "uname";
|
||||
final String pwd = "pwd";
|
||||
@@ -63,7 +64,7 @@ public class DriverManagerDataSourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUsageWithConnectionProperties() throws Exception {
|
||||
public void usageWithConnectionProperties() throws Exception {
|
||||
final String jdbcUrl = "url";
|
||||
|
||||
final Properties connProps = new Properties();
|
||||
@@ -96,7 +97,7 @@ public class DriverManagerDataSourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUsageWithConnectionPropertiesAndUserCredentials() throws Exception {
|
||||
public void usageWithConnectionPropertiesAndUserCredentials() throws Exception {
|
||||
final String jdbcUrl = "url";
|
||||
final String uname = "uname";
|
||||
final String pwd = "pwd";
|
||||
@@ -135,12 +136,12 @@ public class DriverManagerDataSourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidClassName() throws Exception {
|
||||
public void invalidClassName() {
|
||||
String bogusClassName = "foobar";
|
||||
DriverManagerDataSource ds = new DriverManagerDataSource();
|
||||
assertThatIllegalStateException().isThrownBy(() ->
|
||||
ds.setDriverClassName(bogusClassName))
|
||||
.withCauseInstanceOf(ClassNotFoundException.class);
|
||||
assertThatIllegalStateException().isThrownBy(
|
||||
() -> ds.setDriverClassName(bogusClassName))
|
||||
.withCauseInstanceOf(ClassNotFoundException.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user