I created an eclipse project that has the following simple test:
@DataProvider(name = "byteArrayTest")
public Object[][] byteArrayTestDataProvider() {
return new Object[][] {
{ "1", new byte[] { 1 } },
};
}
@Test(dataProvider = "byteArrayTest")
public void byteArrayTest(String s, byte[] bytes) {
System.out.println("BEFORE");
assertTrue("1".equals(s) && bytes[0] == 1);
System.out.println("AFTER");
}
This test succeeds as expected from the command line in 6.8.1 and using Eclipse's Run As->TestNG Test in 6.8.0.
Using Eclipse's Run As->TestNG Test with 6.8.1, however, yields the following ClassCastException:
java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object;
at org.testng.remote.strprotocol.TestResultMessage.toString(TestResultMessage.java:313)
at org.testng.remote.strprotocol.TestResultMessage.<init>(TestResultMessage.java:108)
at org.testng.remote.strprotocol.TestResultMessage.<init>(TestResultMessage.java:126)
at org.testng.remote.strprotocol.RemoteTestListener.onTestFailure(RemoteTestListener.java:72)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1895)
at org.testng.internal.Invoker.runTestListeners(Invoker.java:1879)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:778)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
The "BEFORE" and "AFTER" println()s never occur, so the test doesn't actually run.
I created an eclipse project that has the following simple test:
This test succeeds as expected from the command line in 6.8.1 and using Eclipse's Run As->TestNG Test in 6.8.0.
Using Eclipse's Run As->TestNG Test with 6.8.1, however, yields the following ClassCastException:
The "BEFORE" and "AFTER" println()s never occur, so the test doesn't actually run.
A workaround is to use Byte[] instead of byte[].