I submit these patches as changes I found useful for using ApprovalTests from within a Weblogic application server context. My tests involve code that require application server resources, like JCA and server provided connection technologies, so my tests were not possible by executing code from within public static main.
The changes to Approvals.java include an unnecessary Exception declaration since the called method does not throw any exception. The second change allows for the specification of an alternative ApprovalNamer implementation by way of -Dorg.approvaltests.namer.ApprovalNamer. This change was required to specify an alternative implementation class that would allow the saving and comparison of approval test results located in a directory other than the source directory. When using Jdeveloper in combination with Weblogic, each execution of the project deleted and recreated the deployment directory, which is where the approval test results were being saved. By specifying an external static directory, the test results can be reused between executions.
The changes to ClassUtils.java allow for the completion of the source directory locating code by allowing for the current directory of the class file to be used if the java source file cannot be found, which is the case when using an application server execution environment. I don't think this will work if the test case is bundled within a jar file, but I'll have to test for that condition in our deployment environment instead of the local testing environment.
The patch was created using svn diff from the approvaltests/trunk/code/java directory.
View and moderate all "patches Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Patches"
Suggestions for application server context