Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8303525

Refactor/cleanup open/test/jdk/javax/rmi/ssl/SSLSocketParametersTest.java

XMLWordPrintable

    • b21

        1. The HelloImpl and HelloClient classes aren't adding much value and can pretty much be deleted if the object is exported with something like:

        Hello stub = (Hello) UnicastRemoteObject.exportObject(new HelloImpl(), port, csf, ssf);

        or similar.

        2. The ClientFactory and ServerFactory classes aren't adding much value. They override the create methods and print a message, but otherwise don't do anything beyond what's done in their respective superclasses.

        3. The exception handling is now fairly simple, but one still needs to read through the code to figure out what is actually being tested. The expectedException boolean also makes things a little harder to read since it can invert the logic. I observe that the various test frameworks (such as Test-NG or JUnit) have APIs for this such as assertThrows or expectThrows which return the caught exception, allowing additional assertions to be made over it, and failing the test if the expected exception type isn't thrown. I think this would improve the test cases where an exception is expected, but it might not be worth the effort of converting to one of the frameworks.

              mdonovan Matthew Donovan
              mdonovan Matthew Donovan
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: