1

这是我的数据提供者方法的一部分:

@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
4

1 回答 1

1

0.00 是双倍的,不是浮动的。请改用 0 或 0.00F。

于 2015-04-10T10:21:12.907 回答