Jon Hall

Modify TimeFormatterTest to work on some systems to address [ONOS-2732]

Change-Id: I42d37f3610e27e07c8f4191d2b2b7c192e75e55b
...@@ -24,7 +24,7 @@ import org.onosproject.ui.table.CellFormatter; ...@@ -24,7 +24,7 @@ import org.onosproject.ui.table.CellFormatter;
24 24
25 import java.util.Locale; 25 import java.util.Locale;
26 26
27 -import static org.junit.Assert.assertEquals; 27 +import static org.junit.Assert.assertTrue;
28 28
29 /** 29 /**
30 * Unit tests for {@link TimeFormatter}. 30 * Unit tests for {@link TimeFormatter}.
...@@ -35,7 +35,8 @@ public class TimeFormatterTest { ...@@ -35,7 +35,8 @@ public class TimeFormatterTest {
35 private static final DateTimeZone ZONE = DateTimeZone.UTC; 35 private static final DateTimeZone ZONE = DateTimeZone.UTC;
36 36
37 private static final DateTime TIME = new DateTime(2015, 5, 4, 15, 30, ZONE); 37 private static final DateTime TIME = new DateTime(2015, 5, 4, 15, 30, ZONE);
38 - private static final String EXP_OUTPUT = "3:30:00 PM UTC"; 38 + private static final String EXP_ZONE_NAME = "3:30:00 PM UTC";
39 + private static final String EXP_ZONE_OFFSET = "3:30:00 PM +00:00";
39 40
40 // Have to use explicit Locale and TimeZone for the unit test, so that 41 // Have to use explicit Locale and TimeZone for the unit test, so that
41 // irrespective of which locale and time zone the test is run in, it 42 // irrespective of which locale and time zone the test is run in, it
...@@ -45,6 +46,7 @@ public class TimeFormatterTest { ...@@ -45,6 +46,7 @@ public class TimeFormatterTest {
45 46
46 @Test 47 @Test
47 public void basic() { 48 public void basic() {
48 - assertEquals("wrong format", EXP_OUTPUT, fmt.format(TIME)); 49 + assertTrue("wrong format", (EXP_ZONE_NAME.equals(fmt.format(TIME)) ||
50 + EXP_ZONE_OFFSET.equals(fmt.format(TIME))));
49 } 51 }
50 } 52 }
......