cbeust/testng — pull request #513 by yongtanggithub (2014-04-23 08:26:57+00:00)
Title: Fix an issue that data provider passes invalid parameters to test method when using a combination of fixed and var args

I encountered an issue while performing my tests, say:

@DataProvider
private Iterator\ testData() {
return Arrays.asList("a", "b", "c", "d").iterator();
}

@Test(dataProvider="testData")
private void test(String fixedArg1, Object fixedArg2, String... args) {}

In this case, actually, the three parameters passed to test method are identically, which is {"a", "b", "c", "d"}, therefore resulting in a parameter conflict exception.

After investigating testng source code, the root cause for this issue is located at org.testng.internal.Invoker.java:1358
```
if (method.isVarArgs()) vResult.add(parameterValues);
else vResult.add(parameterValues[i++]);
```
Here, we only examine if the test method has var args, but ignore that it may have fixed args as well.
I add a examine condition that investigates if the current parameter type is an array, which can fix this issue:
```
if (method.isVarArgs() && cls.isArray()) vResult.add(Arrays.copyOfRange(parameterValues, i, numValues));
else vResult.add(parameterValues[i++]);
```
Please be noted that this change only takes effect under java 1.6+.

Hope you guys review this change and commit it if correct. Thanks;)