结果一样,但是测试用例没有通过单元测试

我只是碰了单元测试,今天遇到了一个很奇怪的问题,我用assertThat来判断两个对象是否相等,有一个测试用例不能通过,当我测试这个对象的时候:

 sealed class SummaryViewState : MviViewState { /** * 默认显示曲线图和标签汇总状态(首次进入页面) */ data class SummaryDataViewState( val points: List<Pair<Int, Float>>, // 曲线图点val months: List<Pair<String, Date>>, // 曲线图月份val values: List<String>, // 曲线图数值文本val selectedIndex: Int, // 曲线图选中月份索引val summaryItemList: List<SummaryListItem> // 当月标签汇总列表) : SummaryViewState() /** * 切换月份时标签汇总状态*/ data class SummaryGroupingTagViewState( val summaryItemList: List<SummaryListItem> // 当月标签汇总列表) : SummaryViewState() } 

但是看结果是一样的:

 java.lang.AssertionError: Expected: is <[SummaryDataViewState(points=[(0, 100.0), (5, 200.0)], months=[(五月, Mon May 01 22:47:00 CST 2017), (六月, Thu Jun 01 22:47:00 CST 2017), (七月, Sat Jul 01 22:47:00 CST 2017), (八月, Tue Aug 01 22:47:00 CST 2017), (九月, Fri Sep 01 22:47:00 CST 2017), (十月, Sun Oct 01 22:47:00 CST 2017)], values=[¥100.00, ¥200.00], selectedIndex=5, summaryItemList=[SummaryListItem(tagName=晚餐, total=¥200.00)])]> but: was <[SummaryDataViewState(points=[(0, 100.0), (5, 200.0)], months=[(五月, Mon May 01 22:47:00 CST 2017), (六月, Thu Jun 01 22:47:00 CST 2017), (七月, Sat Jul 01 22:47:00 CST 2017), (八月, Tue Aug 01 22:47:00 CST 2017), (九月, Fri Sep 01 22:47:00 CST 2017), (十月, Sun Oct 01 22:47:00 CST 2017)], values=[¥100.00, ¥200.00], selectedIndex=5, summaryItemList=[SummaryListItem(tagName=晚餐, total=¥200.00)])]> Expected :is <[SummaryDataViewState(points=[(0, 100.0), (5, 200.0)], months=[(五月, Mon May 01 22:47:00 CST 2017), (六月, Thu Jun 01 22:47:00 CST 2017), (七月, Sat Jul 01 22:47:00 CST 2017), (八月, Tue Aug 01 22:47:00 CST 2017), (九月, Fri Sep 01 22:47:00 CST 2017), (十月, Sun Oct 01 22:47:00 CST 2017)], values=[¥100.00, ¥200.00], selectedIndex=5, summaryItemList=[SummaryListItem(tagName=晚餐, total=¥200.00)])]> Actual :<[SummaryDataViewState(points=[(0, 100.0), (5, 200.0)], months=[(五月, Mon May 01 22:47:00 CST 2017), (六月, Thu Jun 01 22:47:00 CST 2017), (七月, Sat Jul 01 22:47:00 CST 2017), (八月, Tue Aug 01 22:47:00 CST 2017), (九月, Fri Sep 01 22:47:00 CST 2017), (十月, Sun Oct 01 22:47:00 CST 2017)], values=[¥100.00, ¥200.00], selectedIndex=5, summaryItemList=[SummaryListItem(tagName=晚餐, total=¥200.00)])]> 

我的测试在这里 ,有人可以解决这个问题,告诉我什么问题?

Kotlin language will be the best programming language for Android.