Allon Mureinik has uploaded a new change for review. Change subject: core: Convert TimeSpanTest to JUnit4 syntax ......................................................................
core: Convert TimeSpanTest to JUnit4 syntax Change-Id: I5c8660975a1f0500fe2fc455330c0f2198d54cc5 Signed-off-by: Allon Mureinik <[email protected]> --- M backend/manager/modules/compat/src/test/java/org/ovirt/engine/core/compat/TimeSpanTest.java 1 file changed, 12 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/55/13855/1 diff --git a/backend/manager/modules/compat/src/test/java/org/ovirt/engine/core/compat/TimeSpanTest.java b/backend/manager/modules/compat/src/test/java/org/ovirt/engine/core/compat/TimeSpanTest.java index c956952..c626d06 100644 --- a/backend/manager/modules/compat/src/test/java/org/ovirt/engine/core/compat/TimeSpanTest.java +++ b/backend/manager/modules/compat/src/test/java/org/ovirt/engine/core/compat/TimeSpanTest.java @@ -1,9 +1,14 @@ package org.ovirt.engine.core.compat; -import junit.framework.TestCase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; -public class TimeSpanTest extends TestCase { +import org.junit.Test; +public class TimeSpanTest { + + @Test public void testBasicConstructors() { TimeSpan span = new TimeSpan(10, 10, 10); assertEquals("hours1", 10, span.Hours); @@ -13,6 +18,7 @@ assertEquals("miliseconds", 0, span.Milliseconds); } + @Test public void testNegativeConstructors() { TimeSpan span = new TimeSpan(1, -20, -10, 10); assertEquals("days1", 0, span.Days); @@ -22,6 +28,7 @@ assertEquals("miliseconds", 0, span.Milliseconds); } + @Test public void testParsing() { TimeSpan span = TimeSpan.Parse("1"); assertEquals("days1", 1, span.Days); @@ -57,15 +64,12 @@ assertEquals("ms7", -5, span.Milliseconds); } + @Test(expected = IllegalArgumentException.class) public void testInvalidParse() { - try { - TimeSpan.Parse("1.02.03"); - fail("No exception was thrown"); - } catch (IllegalArgumentException e) { - // eat it, we are ok - } + TimeSpan.Parse("1.02.03"); } + @Test public void testTryParse() { TimeSpan ref = TimeSpan.tryParse("-1.02:03:04.05"); assertNotNull("A TimeSpan should be returned", ref); -- To view, visit http://gerrit.ovirt.org/13855 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5c8660975a1f0500fe2fc455330c0f2198d54cc5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
