Author: taher
Date: Tue Jul 19 08:20:45 2016
New Revision: 1753348

URL: http://svn.apache.org/viewvc?rev=1753348&view=rev
Log:
Break down the tests of requestStatus and requestShutdown - OFBIZ-7897

The two tests were lumped together and if one throws an exception the other
will never throw it. So test coverage was not done properly. This commit
fixes this issue by separating the calls into two different tests.

Modified:
    
ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java

Modified: 
ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java?rev=1753348&r1=1753347&r2=1753348&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java
 (original)
+++ 
ofbiz/trunk/framework/start/src/test/java/org/apache/ofbiz/base/start/OfbizStartupUnitTests.java
 Tue Jul 19 08:20:45 2016
@@ -70,14 +70,21 @@ public class OfbizStartupUnitTests {
     }
 
     @Test
-    public void adminClientReturnsTheCorrectMessageIfServerIsDown() throws 
StartupException {
-        assertThat(sendRequestToAdminClient("--status"), equalTo("OFBiz is 
Down"));
-        assertThat(sendRequestToAdminClient("--shutdown"), equalTo("OFBiz is 
Down"));
+    public void adminClientReturnsTheCorrectMessageIfServerIsDownOnStatus() 
throws StartupException {
+        Config config = sendRequestToAdminClient("--status");
+
+        assertThat(AdminClient.requestStatus(config), equalTo("OFBiz is 
Down"));
+    }
+
+    @Test
+    public void adminClientReturnsTheCorrectMessageIfServerIsDownOnShutdown() 
throws StartupException {
+        Config config = sendRequestToAdminClient("--shutdown");
+
+        assertThat(AdminClient.requestShutdown(config), equalTo("OFBiz is 
Down"));
     }
 
-    private String sendRequestToAdminClient(String request) throws 
StartupException {
+    private Config sendRequestToAdminClient(String request) throws 
StartupException {
         List<StartupCommand> startupCommands = 
StartupCommandUtil.parseOfbizCommands(new String[]{request});
-        Config config = new Config(startupCommands);
-        return AdminClient.requestStatus(config);
+        return new Config(startupCommands);
     }
 }


Reply via email to