SOLR-9966: Fix previous commit bug

This commit is contained in:
Cao Manh Dat 2017-02-19 15:19:57 +07:00
parent 6358afbea6
commit 54303260aa
2 changed files with 4 additions and 1 deletions

View File

@ -35,6 +35,7 @@ import java.util.Properties;
import javax.sql.DataSource;
import org.apache.lucene.util.Constants;
import org.apache.solr.handler.dataimport.JdbcDataSource.ResultSetIterator;
import static org.mockito.Mockito.*;
import org.junit.After;
@ -484,6 +485,8 @@ public class TestJdbcDataSource extends AbstractDataImportHandlerTestCase {
@Test
public void testRetrieveFromDriverManager() throws Exception {
// in JDK9, Class.forName will throw exception for mock classes
if (Constants.JRE_IS_MINIMUM_JAVA9) return;
DriverManager.registerDriver(driver);
try {
when(driver.connect(notNull(),notNull())).thenReturn(connection);

View File

@ -98,7 +98,7 @@ public class TestCoreAdminApis extends SolrTestCaseJ4 {
when(mockCC.getCoreRootDirectory()).thenReturn(Paths.get("coreroot"));
when(mockCC.getContainerProperties()).thenReturn(new Properties());
when(mockCC.getRequestHandlers()).thenReturn((PluginBag<SolrRequestHandler>) out.get("getRequestHandlers"));
when(mockCC.getRequestHandlers()).thenAnswer(invocationOnMock -> out.get("getRequestHandlers"));
return mockCC;
}