From 78791871b0d75893c9da06adaa4c00ef7c0c84a8 Mon Sep 17 00:00:00 2001 From: baztian Date: Wed, 3 Jun 2020 21:48:04 +0200 Subject: [PATCH] Change float test to double to resolve issues with Jython --- .../main/java/org/jaydebeapi/mockdriver/MockConnection.java | 4 ++-- test/test_mock.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mockdriver/src/main/java/org/jaydebeapi/mockdriver/MockConnection.java b/mockdriver/src/main/java/org/jaydebeapi/mockdriver/MockConnection.java index 8f9c0fd..7d8b3c2 100644 --- a/mockdriver/src/main/java/org/jaydebeapi/mockdriver/MockConnection.java +++ b/mockdriver/src/main/java/org/jaydebeapi/mockdriver/MockConnection.java @@ -76,7 +76,7 @@ public abstract class MockConnection implements Connection { Mockito.when(this.prepareStatement(Mockito.anyString())).thenReturn(mockPreparedStatement); } - public final void mockFloatDecimalResult(float value) throws SQLException { + public final void mockDoubleDecimalResult(double value) throws SQLException { PreparedStatement mockPreparedStatement = Mockito.mock(PreparedStatement.class); Mockito.when(mockPreparedStatement.execute()).thenReturn(true); mockResultSet = Mockito.mock(ResultSet.class, "ResultSet(for other)"); @@ -86,7 +86,7 @@ public abstract class MockConnection implements Connection { Mockito.when(mockResultSet.getMetaData()).thenReturn(mockMetaData); Mockito.when(mockMetaData.getColumnCount()).thenReturn(1); - Float columnValue = Float.valueOf(value); + Double columnValue = Double.valueOf(value); Mockito.when(mockResultSet.getObject(1)).thenReturn(value); Mockito.when(mockMetaData.getColumnType(1)).thenReturn(Types.DECIMAL); Mockito.when(this.prepareStatement(Mockito.anyString())).thenReturn(mockPreparedStatement); diff --git a/test/test_mock.py b/test/test_mock.py index 766561c..61f15de 100644 --- a/test/test_mock.py +++ b/test/test_mock.py @@ -71,8 +71,8 @@ class MockTest(unittest.TestCase): result = cursor.fetchone() self.assertEquals(str(result[0]), "1234.5") - def test_float_decimal(self): - self.conn.jconn.mockFloatDecimalResult(1234.5) + def test_double_decimal(self): + self.conn.jconn.mockDoubleDecimalResult(1234.5) cursor = self.conn.cursor() cursor.execute("dummy stmt") result = cursor.fetchone()