Paul Armborst

Anyone tried Mockito with BRUnit?

Discussion created by Paul Armborst on Jul 6, 2012
Latest reply on Mar 5, 2013 by Andrei Palskoi

Our Advisor application needs to access reference data as well as transactional data, so we have a global variable containing a reference to a reference data class with methods that invoke SQL queries.  The rules (and for that matter the entire application) use that class to access reference data in the database.  Of course, the reference data class expects a connection to an actual database.

 

Which is not what unit testing is all about....so in the setup for BRUnit, I have tried to replace that reference with a mock reference data object with stub methods that return hard-coded data to satisfy the rules.  However, when the test runs the rules are still trying to use the actual reference data class, which results in NullPointer exceptions.  (I assume the actual reference data class is being accessed because the reference data variable is global in scope--but it needs to be since all of the application's rulesets need to access the reference data.)

 

For JUnit, we use Mockito to get around this problem.  I am wondering if anyone has used Mockito successfully as part of BRUnit testing.

 

 

Outcomes