### Question:
DataSourcePopulator implements Serializable { public void initialize(DataSource dataSource) { validateProperties(); populateDataSourceIfNecessary(dataSource); } DataSourcePopulator();  DataSourcePopulator(List<Resource> scriptLocations, String executeScriptQuery); void setExecuteScriptQuery(String executeScriptQuery); void setScriptLocations(List<Resource> scriptLocations); void initialize(DataSource dataSource);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void invalid_config() { populator = new DataSourcePopulator(null, CHECK_QUERY); populator.initialize(dataSource); }
@Test public void null_check() throws SQLException { Statement populate = createNiceMock(Statement.class); expect(populate.execute(INSERT)).andReturn(true).once(); replay(populate); expect(connection.createStatement()).andReturn(populate).once(); connection.close(); expectLastCall(); replay(connection); populator = new DataSourcePopulator(resourceList, null); populator.initialize(dataSource); verify(populate); }