Allon Mureinik has uploaded a new change for review.

Change subject: tools: Proper error testing in EngineConfigCLITest
......................................................................

tools: Proper error testing in EngineConfigCLITest

Converted the error tests in EngineConfigCLITest to the proper JUnit
form (with the expect parameter on the @Test annotation), instead of the
awkward explicit fail before the catch block.

Since the test methods have meaningful names, this change also allowed
removing the System.out.println calls.

Change-Id: Iad25eae4fd7b4535cc1b2d9570f142d6996b79d0
Signed-off-by: Allon Mureinik <[email protected]>
---
M 
backend/manager/tools/src/test/java/org/ovirt/engine/core/config/EngineConfigCLIParserTest.java
1 file changed, 4 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/24/14424/1

diff --git 
a/backend/manager/tools/src/test/java/org/ovirt/engine/core/config/EngineConfigCLIParserTest.java
 
b/backend/manager/tools/src/test/java/org/ovirt/engine/core/config/EngineConfigCLIParserTest.java
index 26c45b6..c0e761f 100644
--- 
a/backend/manager/tools/src/test/java/org/ovirt/engine/core/config/EngineConfigCLIParserTest.java
+++ 
b/backend/manager/tools/src/test/java/org/ovirt/engine/core/config/EngineConfigCLIParserTest.java
@@ -3,7 +3,6 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -29,29 +28,14 @@
         assertEquals(ConfigActionType.ACTION_LIST, parser.getConfigAction());
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException.class)
     public void testParseNoAction() {
-        System.out.println("Testing parse args with no action...");
-        try {
-            parser.parse(new String[] { "-b", "-t", "filename" });
-            // An exception should be thrown
-            fail();
-        } catch (Exception e) {
-            System.out.println(e.getMessage());
-        }
-        System.out.println("\n");
+        parser.parse(new String[] { "-b", "-t", "filename" });
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException.class)
     public void testParseActionNotFirst() throws Exception {
-        System.out.println("Testing parse args with action not first...");
-        try {
-            parser.parse(new String[] { "-b", "-a", "filename" });
-            // An exception should be thrown
-            fail();
-        } catch (Exception e) {
-            System.out.println(e.getMessage());
-        }
+        parser.parse(new String[] { "-b", "-a", "filename" });
     }
 
     @Test


--
To view, visit http://gerrit.ovirt.org/14424
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iad25eae4fd7b4535cc1b2d9570f142d6996b79d0
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

Reply via email to