Skip to content

Commit

Permalink
Fix data-api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ebocher committed Jun 3, 2024
1 parent 5ec7353 commit 8a880f8
Showing 1 changed file with 0 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,6 @@
*/
public class IJdbcDataSourceTest {

/**
* Test the {@link IJdbcDataSource#invokeMethod(String, Object)} method.
*/
@Test
public void testInvokeMethod() {
IJdbcDataSource ds = new IJdbcDataSourceTest.DummyDataSource();
ds.setProperty("prop1", "value1");
assertEquals("value1", ds.invokeMethod("getProperty", "prop1"));
assertTrue((Boolean) ds.invokeMethod("noArg", null));
assertTrue((Boolean) ds.invokeMethod("getNoArg", null));
assertArrayEquals(new Object[]{"string", 0.2}, (Object[]) ds.invokeMethod("arrayMethod", new Object[]{"string", 0.2}));
assertArrayEquals(new Object[]{"string", 0.2}, (Object[]) ds.invokeMethod("getArrayMethod", new Object[]{"string", 0.2}));
assertArrayEquals(new Object[]{"string", 0.2}, (Object[]) ds.invokeMethod("getParametersMethod", new Object[]{"string", 0.2}));
assertArrayEquals(new Object[]{"string", 0.2}, (Object[]) ds.invokeMethod("parametersMethod", new Object[]{"string", 0.2}));
assertArrayEquals(new Object[]{"string", "0.2"}, (Object[]) ds.invokeMethod("getParametersMethod", new Object[]{"string", "0.2"}));
assertArrayEquals(new Object[]{"string", "0.2"}, (Object[]) ds.invokeMethod("parametersMethod", new Object[]{"string", "0.2"}));
assertEquals("string", ds.invokeMethod("getParameterMethod", new Object[]{"string"}));
assertEquals("string", ds.invokeMethod("getParameterMethod", "string"));
assertEquals("string", ds.invokeMethod("parameterMethod", new Object[]{"string"}));
assertEquals("string", ds.invokeMethod("parameterMethod", "string"));

assertThrows(MissingMethodException.class, () -> ds.invokeMethod("setProperty", new String[]{"tata"}));
assertNull(ds.invokeMethod("getProperty", null));
assertThrows(MissingMethodException.class, () -> ds.invokeMethod("notAMethod", null));
}

/**
* Test the {@link IJdbcDataSource#executeScript(String)} and {@link IJdbcDataSource#executeScript(InputStream)}
Expand All @@ -115,23 +90,6 @@ public void testExecuteScript() throws Exception {
assertTrue(ds.isStreamScript());
}

/**
* Test the {@link IJdbcDataSource#getProperty(String)} and {@link IJdbcDataSource#setProperty(String, Object)}
* methods.
*/
@Test
public void testGetProperty() {
IJdbcDataSource ds = new IJdbcDataSourceTest.DummyDataSource();

ds.setProperty("prop1", "value1");
ds.setProperty("prop2", "value2");

assertEquals("value1", ds.getProperty("prop1"));
assertEquals("value2", ds.getProperty("prop2"));
assertNull(ds.getProperty(null));
assertThrows(MissingPropertyException.class, () -> ds.getProperty("databaseType"));
}

/**
* Test the {@link IJdbcDataSource} methods with {@link Exception} thrown.
*/
Expand Down

0 comments on commit 8a880f8

Please sign in to comment.