You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by gg...@apache.org on 2023/06/23 17:51:08 UTC

[juneau] 11/11: [juneau-utest] Throw IllegalArgumentException instead of RuntimeException

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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git

commit ca352d8da192c2f27d59fb7cab8479c631f33198
Author: Gary Gregory <gg...@rocketsoftware.com>
AuthorDate: Fri Jun 23 13:50:30 2023 -0400

    [juneau-utest] Throw IllegalArgumentException instead of
    RuntimeException
---
 .../juneau/a/rttests/RoundTripBeanInheritanceTest.java       |  6 +++---
 .../org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java   | 10 +++++-----
 .../juneau/a/rttests/RoundTripObjectsAsStringsTest.java      | 12 ++++++------
 .../java/org/apache/juneau/config/ConfigMapListenerTest.java |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanInheritanceTest.java b/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanInheritanceTest.java
index 286066adb..ae6663aa6 100755
--- a/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanInheritanceTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanInheritanceTest.java
@@ -126,15 +126,15 @@ public class RoundTripBeanInheritanceTest extends RoundTripTest {
 		}
 
 		public String isX() {
-			throw new RuntimeException("Should not be called!");
+			throw new IllegalCallerException("Should not be called!");
 		}
 
 		public String isY() {
-			throw new RuntimeException("Should not be called!");
+			throw new IllegalCallerException("Should not be called!");
 		}
 
 		public String isZ() {
-			throw new RuntimeException("Should not be called!");
+			throw new IllegalCallerException("Should not be called!");
 		}
 	}
 
diff --git a/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java b/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
index 134adfaa0..8db38c31e 100755
--- a/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripBeanMapsTest.java
@@ -828,7 +828,7 @@ public class RoundTripBeanMapsTest extends RoundTripTest {
 		// This method should not be interpreted as the setter for this
 		// property because it doesn't match the getter return type above.
 		public void setA(KEnum a) {
-			throw new RuntimeException("Should not be called!");
+			throw new IllegalCallerException("Should not be called!");
 		}
 
 		public void setA(String a) {
@@ -840,11 +840,11 @@ public class RoundTripBeanMapsTest extends RoundTripTest {
 		}
 
 		public void setB(String b) {
-			throw new RuntimeException("Should not be called!");
+			throw new IllegalCallerException("Should not be called!");
 		}
 
 		public void setB(Object b) {
-			throw new RuntimeException("Should not be called!");
+			throw new IllegalCallerException("Should not be called!");
 		}
 
 		public void setB(KEnum b) {
@@ -860,11 +860,11 @@ public class RoundTripBeanMapsTest extends RoundTripTest {
 		}
 
 		public void setC(String c) {
-			throw new RuntimeException("Should not be called!");
+			throw new IllegalCallerException("Should not be called!");
 		}
 
 		public void setC(Object c) {
-			throw new RuntimeException("Should not be called!");
+			throw new IllegalCallerException("Should not be called!");
 		}
 	}
 
diff --git a/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripObjectsAsStringsTest.java b/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripObjectsAsStringsTest.java
index e09daf31a..4052ba269 100755
--- a/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripObjectsAsStringsTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/a/rttests/RoundTripObjectsAsStringsTest.java
@@ -209,13 +209,13 @@ public class RoundTripObjectsAsStringsTest extends RoundTripTest {
 	public static class C1 {
 		public String f;
 		public static C2 valueOf(String s) {
-			throw new RuntimeException("Shouldn't be called!");
+			throw new IllegalCallerException("Shouldn't be called!");
 		}
 		public static C2 parse(String s) {
-			throw new RuntimeException("Shouldn't be called!");
+			throw new IllegalCallerException("Shouldn't be called!");
 		}
 		public static C2 parseString(String s) {
-			throw new RuntimeException("Shouldn't be called!");
+			throw new IllegalCallerException("Shouldn't be called!");
 		}
 		public static C1 fromString(String s) {
 			C1 x = new C1();
@@ -232,10 +232,10 @@ public class RoundTripObjectsAsStringsTest extends RoundTripTest {
 	public static class C2 {
 		public String f;
 		public static C2 parse(String s) {
-			throw new RuntimeException("Shouldn't be called!");
+			throw new IllegalCallerException("Shouldn't be called!");
 		}
 		public static C2 parseString(String s) {
-			throw new RuntimeException("Shouldn't be called!");
+			throw new IllegalCallerException("Shouldn't be called!");
 		}
 		public static C2 valueOf(String s) {
 			C2 x = new C2();
@@ -251,7 +251,7 @@ public class RoundTripObjectsAsStringsTest extends RoundTripTest {
 	public static class C3 {
 		public String f;
 		public static C2 parseString(String s) {
-			throw new RuntimeException("Shouldn't be called!");
+			throw new IllegalCallerException("Shouldn't be called!");
 		}
 		public static C3 parse(String s) {
 			C3 x = new C3();
diff --git a/juneau-utest/src/test/java/org/apache/juneau/config/ConfigMapListenerTest.java b/juneau-utest/src/test/java/org/apache/juneau/config/ConfigMapListenerTest.java
index bf5c35661..ae248ba93 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/config/ConfigMapListenerTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/config/ConfigMapListenerTest.java
@@ -590,6 +590,6 @@ public class ConfigMapListenerTest {
 
 	private static void wait(CountDownLatch latch) throws InterruptedException {
 		if (! latch.await(10, TimeUnit.SECONDS))
-			throw new RuntimeException("Latch failed.");
+			fail("Latch failed.");
 	}
 }