TestNG数组比较AssertJUnit.assertEquals

TestNG数组比较AssertJUnit.assertEquals

  TestNG支持对Junit4测试代码的自动重构(@test tag)
  其中对于数组比较,
   Junit: assertEquals("msg", expected, actual);
  TestNG: AssertJUnit.assertEquals("msg", expected, actual);
  似乎这是一个delegate的处理方式。不过执行的时候报错:
java.lang.AssertionError: correct tokens expected:<[Ljava.lang.String;@941db6> but was:<[Ljava.lang.String;@2acc57>
at org.testng.AssertJUnit.fail(AssertJUnit.java:59)
at org.testng.AssertJUnit.failNotEquals(AssertJUnit.java:364)
at org.testng.AssertJUnit.assertEquals(AssertJUnit.java:80)...
  Baidu上一无所获,于是google. 确认这是一个存在的bug。如下的link讨论的是int[]的情况。估计string[]的情况类似。
  http://code.google.com/p/testng/issues/detail?id=4
  暂时的处理方法:继续用junit的assert方法。但是用testNG来识别@test标记。
  //import org.testng.AssertJUnit;
  import static org.junit.Assert.*;
English »
AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBengaliBelarusianBulgarianCatalanChinese (Simp)Chinese (Trad)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHebrewHindiHungarianIcelandicIndonesianIrishItalianJapaneseKannadaKoreanLaoLatinLatvianLithuanianMacedonianMalayMalteseNorwegianPersianPolishPortugueseRomanianRussianSerbianSlovakSlovenianSpanishSwahiliSwedishTamilTeluguThaiTurkishUkrainianUrduVietnameseWelshYiddish  
Options :  History :  Help :  Feedback
Text-to-speech function is limited to 100 characters

你可能感兴趣的:(TestNG数组比较AssertJUnit.assertEquals)