You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2021/02/21 10:01:22 UTC

[jmeter] 07/07: Get rid of cast (and silence ErrorProne)

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

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

commit d7e745e8179d1994b6688101ce66d08f5c7810ca
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Sun Feb 21 10:53:42 2021 +0100

    Get rid of cast (and silence ErrorProne)
    
    With newer APIs we can make sure, that we get a subclass of UnitTestManager and
    don't need the cast anymore.
---
 src/core/src/test/java/org/apache/jorphan/test/AllTests.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/core/src/test/java/org/apache/jorphan/test/AllTests.java b/src/core/src/test/java/org/apache/jorphan/test/AllTests.java
index 8737c9b..bbbeefa 100644
--- a/src/core/src/test/java/org/apache/jorphan/test/AllTests.java
+++ b/src/core/src/test/java/org/apache/jorphan/test/AllTests.java
@@ -310,7 +310,8 @@ public final class AllTests {
         if (args.length >= 3) {
             try {
                 System.out.println("Using initializeProperties() from " + args[2]);
-                UnitTestManager um = (UnitTestManager) Class.forName(args[2]).getDeclaredConstructor().newInstance();
+                UnitTestManager um = Class.forName(args[2]).asSubclass(UnitTestManager.class).getDeclaredConstructor()
+                        .newInstance();
                 System.out.println("Setting up initial properties using: " + args[1]);
                 um.initializeProperties(args[1]);
             } catch (IllegalArgumentException | ReflectiveOperationException | SecurityException e) {