以下是我的数据提供者方法的一部分:
@DataProvider (name = "dataProvider1")
public static Object[][] dataProvider1()
{
return new Object[][] {
// Total sale 0.00
{ new Object[][]{{MSOECommissionCalculator.REPLACEMNET_ITEM, 0.00},
{MSOECommissionCalculator.REPLACEMNET_ITEM, 0.00},
{MSOECommissionCalculator.REPLACEMNET_ITEM, 0.00},
{MSOECommissionCalculator.REPLACEMNET_ITEM, 0.00},
{MSOECommissionCalculator.CONSULTING_ITEM, 0.00},
{MSOECommissionCalculator.MAINTENANCE_ITEM, 0.00},
{MSOECommissionCalculator.BASIC_ITEM, 0.00},
{MSOECommissionCalculator.MAINTENANCE_ITEM, 0.00}}, 0.00 },
当我使用这样的数据提供者时:
@Test (dataProvider = "dataProvider1", dataProviderClass = MSOECommissionCalculatorTestDataProvider.class)
public void testForProbationary(Object[][] sales, float assertCommission)
{
}
这会产生以下错误:
FAILED: testForProbationary([[Ljava.lang.Object;@380fb434, 0.0)
java.lang.IllegalArgumentException: argument type mismatch
答案 0 :(得分:1)
0.00是双倍,不是浮动。改为使用0或0.00F。