From 23dd65b8421041947027b3b5ab87ddf3b379b5ba Mon Sep 17 00:00:00 2001 From: youbowu Date: Wed, 1 Mar 2017 14:08:54 +0800 Subject: Fix unit test Issue-ID:HOLMES-51 Change-Id: I1fc4a6da12f085cbb8ad2a36ef630823e5707ae3 Signed-off-by:youbowu --- .../java/org/openo/holmes/common/api/stat/AlarmTest.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'holmes-actions/src/test') diff --git a/holmes-actions/src/test/java/org/openo/holmes/common/api/stat/AlarmTest.java b/holmes-actions/src/test/java/org/openo/holmes/common/api/stat/AlarmTest.java index 49858ab..c42ee60 100644 --- a/holmes-actions/src/test/java/org/openo/holmes/common/api/stat/AlarmTest.java +++ b/holmes-actions/src/test/java/org/openo/holmes/common/api/stat/AlarmTest.java @@ -16,6 +16,7 @@ package org.openo.holmes.common.api.stat; +import java.util.Date; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; @@ -84,8 +85,16 @@ public class AlarmTest { @Test public void testToString() throws Exception { - final Alarm alarmTemp = new Alarm(); - assertThat(alarmTemp.toString(), equalTo(alarm.toString())); + Alarm alarmTempA = new Alarm(); + Alarm alarmTempB = new Alarm(); + Date date = new Date(); + alarmTempA.setClearedTime(date); + alarmTempA.setRaisedTime(date); + alarmTempA.setRaisedServerTime(date); + alarmTempB.setClearedTime(date); + alarmTempB.setRaisedTime(date); + alarmTempB.setRaisedServerTime(date); + assertThat(alarmTempA.toString(),equalTo(alarmTempB.toString())); } @Test -- cgit 1.2.3-korg