[英]Junit-check for equality of array of unique class
我是junit和測試的新手。 我有兩個數組,這些數組由類類型MyUniqueClass的對象組成。 如果兩個數組在相同位置具有相同元素,則我認為這兩個數組相等。 另外,我為我的唯一類重寫了equals()方法。
我想檢查junit中這兩個數組的相等性。 我在API中找不到任何方法-http: //junit.sourceforge.net/javadoc/org/junit/Assert.html如何檢查junit中的相等性?
編輯:
當我運行junit測試以比較數組時,出現錯誤:
arrays first differed at element [0]; expected: com.test.IntegerRange<[210, 210]> but was: com.test.IntegerRange<[210, 210]>
at org.junit.internal.ComparisonCriteria.arrayEquals(ComparisonCriteria.java:50)
at org.junit.Assert.internalArrayEquals(Assert.java:473)
謝謝 !
您可能會靠近一點。 在您鏈接到的頁面中,我發現了這一點:
public static void assertArrayEquals(java.lang.String message,
java.lang.Object[] expecteds,
java.lang.Object[] actuals)
throws org.junit.internal.ArrayComparisonFailure
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.