Change float test to double to resolve issues with Jython
parent
d8b96c510e
commit
78791871b0
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue