Change float test to double to resolve issues with Jython

master
baztian 2020-06-03 21:48:04 +02:00
parent d8b96c510e
commit 78791871b0
2 changed files with 4 additions and 4 deletions

View File

@ -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);

View File

@ -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()