You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2022/11/28 15:06:58 UTC

[cloudstack] branch main updated: Simplify Test Case ApplicationLoadBalancerTest.searchForNonExistingLoadBalancer (#6882)

This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 7aeb5b08104 Simplify Test Case ApplicationLoadBalancerTest.searchForNonExistingLoadBalancer (#6882)
7aeb5b08104 is described below

commit 7aeb5b081048b2c5ca81c63e7afe8640edc839ef
Author: Codegass <wc...@gmail.com>
AuthorDate: Mon Nov 28 10:06:50 2022 -0500

    Simplify Test Case ApplicationLoadBalancerTest.searchForNonExistingLoadBalancer (#6882)
---
 .../network/lb/ApplicationLoadBalancerTest.java         | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/server/src/test/java/org/apache/cloudstack/network/lb/ApplicationLoadBalancerTest.java b/server/src/test/java/org/apache/cloudstack/network/lb/ApplicationLoadBalancerTest.java
index 939293ed15b..b246855c289 100644
--- a/server/src/test/java/org/apache/cloudstack/network/lb/ApplicationLoadBalancerTest.java
+++ b/server/src/test/java/org/apache/cloudstack/network/lb/ApplicationLoadBalancerTest.java
@@ -186,22 +186,11 @@ public class ApplicationLoadBalancerTest extends TestCase {
         assertNotNull("Couldn't find existing application load balancer", rule);
     }
 
-    @Test
+    @Test(expected = InvalidParameterValueException.class)
     //Negative test - try to retrieve non-existing lb
         public
-        void searchForNonExistingLoadBalancer() {
-        boolean notFound = false;
-        ApplicationLoadBalancerRule rule = null;
-        try {
-            rule = _appLbSvc.getApplicationLoadBalancer(nonExistingLbId);
-            if (rule != null) {
-                notFound = false;
-            }
-        } catch (InvalidParameterValueException ex) {
-            notFound = true;
-        }
-
-        assertTrue("Found non-existing load balancer; no invalid parameter value exception was thrown", notFound);
+        void searchForNonExistingLoadBalancer() throws InvalidParameterValueException {
+        _appLbSvc.getApplicationLoadBalancer(nonExistingLbId);
     }
 
     /**