### Question:
IntToFloat extends AbstractReformatToFloat<Integer> { @Override protected float apply(double number, double scaleFactor, double addOffset) { return (float) (scaleFactor * number + addOffset); } IntToFloat();   }### Answer:
@Override @Test public void testNumericConversion() throws RuleException { final Rule rule = getRule(); final Item sourceColumn = getSourceColumn(); final Array sourceArray = Array.factory(DataType.INT, new int[]{2}); sourceArray.setInt(0, 5); sourceArray.setInt(1, 7); final Array targetArray = rule.apply(sourceArray, sourceColumn); assertTrue(targetArray.getElementType() == float.class); assertEquals(10.5f, targetArray.getFloat(0), 0.0f); assertEquals(14.5f, targetArray.getFloat(1), 0.0f); }
@Test(expected = RuleException.class) public void testColumnConversion_ImproperType() throws RuleException { getRule().apply(new ColumnBuilder().type(DataType.BYTE).build()); }